Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp318734rwl; Fri, 4 Nov 2022 00:16:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EWCNc7qGnEd3fL/1v2Krz091Ivr9SOX0BET8FDuv7pTE1hScFPu8DsgB/DsVkxWEcEkvu X-Received: by 2002:a05:6402:616:b0:463:e2cd:a88d with SMTP id n22-20020a056402061600b00463e2cda88dmr14579304edv.400.1667546201066; Fri, 04 Nov 2022 00:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667546201; cv=none; d=google.com; s=arc-20160816; b=rRrvyNULJVzpcwXltvihaW61K0EWnXZXmTC4lDtTFUAgVq7F4M+Wdrllha0u3ikPWD P2OZXApPiAfoFdOMrTVubKKLeJB24BZHOm6pFdGqUorT+aUTxAg8WazNHyuhY8EVTAYf dIHBuI+9nWrCGwFL9+TA4/N1aSwoIrSabQE+B8uFD3xPi0CQoALYo4kjeAO8jaqF5L8A NcC5C321YcD2dwHN09tQh7rnQrjHq/l53f6DYFfKEGjCdP4bIPVVnEvdtX2z3/oYXkIu 9wNdmMnaHW0nqNe7Z6i+JYIzTcTE0AlNkVIiYZLCtsO5yVCb7qmVSvqsMwLtTwiur2hw 1GAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DVozv4ww3RPgAifx8iLDCASk/cNq9WwNyTxXIFAOdb0=; b=Bxi4e6LvfJilxs60f2wziOnhFBXG0up3nREhdIYitqFOvuGoMKO1r6mpcagOaNWCQg 2hSQRXSEa4x6L/kr93bTI1tdPJH2MFqMHC+gG0R+voBSk1GlREV2+NavUwvLZNrAxWFV pwM9A/S2X7xycQZVMS23apsUINoKbg6N9wH3y9k4vqubyXy+vVDLYMPksHyj42S3TjfF Jl7jXj9ZagI/IW9F0iAqPFukvyG+oy61wufBEX8AZUQJCq+yA4AqCHaZWG051mOM/0Wk Rfw/TPTZeUtthCmtrEKtdzocn1KcNA7wM2UINDKbeyised+D2rwMiicu/cuLWHBeOsqr Zg/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=sh3WaLpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho7-20020a1709070e8700b007ad855bc09csi4468727ejc.595.2022.11.04.00.16.18; Fri, 04 Nov 2022 00:16:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=sh3WaLpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230373AbiKDGd4 (ORCPT + 95 others); Fri, 4 Nov 2022 02:33:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbiKDGdy (ORCPT ); Fri, 4 Nov 2022 02:33:54 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95BE9205C2; Thu, 3 Nov 2022 23:33:53 -0700 (PDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A46TBaG007843; Fri, 4 Nov 2022 06:33:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=DVozv4ww3RPgAifx8iLDCASk/cNq9WwNyTxXIFAOdb0=; b=sh3WaLpz0o8YwRtQncBs6tLt83uA6Si+IZYLXqxN8ZEG2nU7PU0SNLNwIm9/noMBo9EL /QZRw/ypiN8Y+oU1IwHN3tYbIeQSv2sbpASRcCDfYMYR1PU9h3VH2Qz2hBzPgr2Yx/rr 5ar7J+BN4T6oQ7NnEILbQjywDhhZPQ+VybBZBsxLDtA/AmhCYic5kkhUPAZX2cOXJh8A SMWX0ZJfg1KJQlHkULTfBxiOy8+zHwVHcjAqVqiWOJm3WEbqf4BR3yayXPWOqUvmqnYt 9qlyThUVvgEnm0r/c8Bswo8F/DeniIMxqpC9xN0nPuox0P0vlmgx1k7ZiW+rVSIX6BOS hw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3kmq07jtcs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Nov 2022 06:33:19 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2A44g7gZ010675; Fri, 4 Nov 2022 06:33:19 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3kmq07jtbu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Nov 2022 06:33:18 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2A46KiUw009676; Fri, 4 Nov 2022 06:33:17 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06fra.de.ibm.com with ESMTP id 3kguejfe7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Nov 2022 06:33:16 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2A46XoWW51577136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Nov 2022 06:33:50 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A235F4C059; Fri, 4 Nov 2022 06:33:13 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 65DC34C044; Fri, 4 Nov 2022 06:33:12 +0000 (GMT) Received: from li-4a3a4a4c-28e5-11b2-a85c-a8d192c6f089.ibm.com (unknown [9.145.40.122]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 4 Nov 2022 06:33:12 +0000 (GMT) Date: Fri, 4 Nov 2022 07:33:10 +0100 From: Alexander Gordeev To: Linus Torvalds Cc: Peter Zijlstra , Will Deacon , Aneesh Kumar , Nick Piggin , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Nadav Amit , Jann Horn , John Hubbard , X86 ML , Matthew Wilcox , Andrew Morton , kernel list , Linux-MM , Andrea Arcangeli , "Kirill A . Shutemov" , Joerg Roedel , Uros Bizjak , Alistair Popple , linux-arch Subject: Re: mm: delay rmap removal until after TLB flush Message-ID: References: <140B437E-B994-45B7-8DAC-E9B66885BEEF@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 4FNpXyGGRtv1khih7wgAOdB8NGiyES6G X-Proofpoint-ORIG-GUID: oUVm0NIeVEvSk1VZrf3NeD5Pcsl8qKsp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_02,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 impostorscore=0 adultscore=0 bulkscore=0 mlxlogscore=921 mlxscore=0 priorityscore=1501 clxscore=1011 malwarescore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040044 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 31, 2022 at 11:43:30AM -0700, Linus Torvalds wrote: [...] > If people really want to see the patches in email again, I can do > that, but most of you already have, and the changes are either trivial > fixes or the s390 updates. > > For the s390 people that I've now added to the participant list maybe > the git tree is fine - and the fundamental explanation of the problem > is in that top-most commit (with the three preceding commits being > prep-work). Or that link to the thread about this all. I rather have a question to the generic part (had to master the code quotting). > static void clean_and_free_pages_and_swap_cache(struct encoded_page **pages, unsigned int nr) > { > for (unsigned int i = 0; i < nr; i++) { > struct encoded_page *encoded = pages[i]; > unsigned int flags = encoded_page_flags(encoded); > if (flags) { > /* Clean the flagged pointer in-place */ > struct page *page = encoded_page_ptr(encoded); > pages[i] = encode_page(page, 0); > > /* The flag bit being set means that we should zap the rmap */ Why TLB_ZAP_RMAP bit is not checked explicitly here, like in s390 version? (I assume, when/if ENCODE_PAGE_BITS is not TLB_ZAP_RMAP only, calling page_zap_pte_rmap() without such a check would be a bug). > page_zap_pte_rmap(page); > VM_WARN_ON_ONCE_PAGE(page_mapcount(page) < 0, page); > } > } > > /* > * Now all entries have been un-encoded, and changed to plain > * page pointers, so we can cast the 'encoded_page' array to > * a plain page array and free them > */ > free_pages_and_swap_cache((struct page **)pages, nr); > } Thanks!