From patchwork Wed Nov 16 07:49:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 20755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp11794wru; Tue, 15 Nov 2022 23:55:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4uFtg14rSfDt0K4130EVuiPxVWC3vt9ZFfHYfwUdBEKFTvSi50RxQy/FcLnssz0DIHMuq8 X-Received: by 2002:a17:90a:ab82:b0:213:c5ae:55ec with SMTP id n2-20020a17090aab8200b00213c5ae55ecmr2396508pjq.182.1668585328018; Tue, 15 Nov 2022 23:55:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668585328; cv=none; d=google.com; s=arc-20160816; b=s8adTEn2kFcp51HwusN7zAd/t7xj1iNTCmPqkrMzXS+LB3smvNlLEzdWDVQuL4oY5r rluGwMvIacAHwHgiFYa24a4dN/rTsxZaVeWRsN3Px/92Iyt/isFeS1bKraWRU6OC9mmd UcCD1HDXKVWuL0Jh9BH1VcVX84IOURQKpV5/bLadYOSuPp4L3V77hlVnlT3Eb/E3R/cj /PoVN8I70iT9+fCjY7UxHxVsml2LVvsujbZT/i8MHtVYMK4tprU6H9MOnpsYpJq0/CQy SbNhErHveFVjRoarkZm5DBrXD87D8LhqYERr00sphFqqwTj554vQP0wZN/Idvo+RiV+9 NeSg== 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=V7U57MhOQVptPYtVtN1POlRv/jzcS/7ubz1R1SMk9wc=; b=E3VpkMe5M7LPRoySPWhN+ZHK85XZnVYjl//heOeFhRshVd06pnhO7zhzNO50ol9EiT AKh8su7L0XHHLmXN+u6Y7C1kKcgydl/ORXuhyRtXoevrm1WwpJomxijGJVrvpFQXNjW4 DgjeSkHbD7zycKZ2w2cETVsVFzuRb0ubxWsjrErkDxunDMEWwt0OBv98NnixDbygMS37 hVX3i7JzwxtZMtEGXs0hpRCzvu5mpsLDbEC5XhUtIvw2z2xHEGEx3LHfyPmcIKly7OG+ huhZNrwr0M6PUjaKdionLCjneL3pgri7mg0pFVip+5Ujbwy1xWlDhWTf4t2T5lI9O9Gi paRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="dE4O/qeU"; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a24-20020a17090a8c1800b002024f3f1f8bsi1382361pjo.70.2022.11.15.23.55.15; Tue, 15 Nov 2022 23:55:27 -0800 (PST) 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="dE4O/qeU"; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232670AbiKPHuA (ORCPT + 99 others); Wed, 16 Nov 2022 02:50:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbiKPHt6 (ORCPT ); Wed, 16 Nov 2022 02:49:58 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C906C13D3A for ; Tue, 15 Nov 2022 23:49:57 -0800 (PST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AG7B3Ae003519; Wed, 16 Nov 2022 07:49:46 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=V7U57MhOQVptPYtVtN1POlRv/jzcS/7ubz1R1SMk9wc=; b=dE4O/qeUlM0Mj4ZBbwRPAuXXZizKKtQ02+ntOSQDagzxKqrjrmvUajTsSYwnM/YzCDHK sxr9jeZ7wvtHpQbNyCFkAN5pxgrof0FQSa6zFCf3MIMLoyok+9zpTribsDNNFv4pWnUQ fKkOlB8AzOHeFrUJnaEwVSC6nPAWIVltXgiMS3F2Vydjx5ZtdA2Pvg6JIqccoDgMRsVF 5YxrlBlzony9Otp26BCmcsrkJLyeAwhCyV9QCGvVlctiZor/sDXh2WBJUYC8G+YFCNyt oFU5P1VSLrFw3aDNWI16uzosoy4/xUM3fiCbHphqXmTt1q6i3yud4DrPS8rhR050cPHQ mQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvu888pte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 07:49:46 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AG7ZIYS027634; Wed, 16 Nov 2022 07:49:46 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvu888psu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 07:49:45 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2AG7Ya6U007559; Wed, 16 Nov 2022 07:49:43 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 3kt348whn5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 07:49:43 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AG7neEQ5046930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Nov 2022 07:49:40 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1ED12A4054; Wed, 16 Nov 2022 07:49:40 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 77F38A405B; Wed, 16 Nov 2022 07:49:34 +0000 (GMT) Received: from li-4a3a4a4c-28e5-11b2-a85c-a8d192c6f089.ibm.com (unknown [9.163.49.19]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 16 Nov 2022 07:49:34 +0000 (GMT) Date: Wed, 16 Nov 2022 08:49:30 +0100 From: Alexander Gordeev To: Linus Torvalds Cc: Hugh Dickins , Johannes Weiner , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Nadav Amit , Will Deacon , Aneesh Kumar , Nick Piggin , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Peter Zijlstra , Gerald Schaefer Subject: mm: mmu_gather: do not expose delayed_rmap flag Message-ID: References: <20221109203051.1835763-1-torvalds@linux-foundation.org> <20221109203051.1835763-4-torvalds@linux-foundation.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 8D-4wtabBeM2LG6gv9fqfaZ3Dv8x0tqL X-Proofpoint-GUID: zQZ6eeo8tYAkN8Iq8NdhOW-wDMbgabpc 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-15_08,2022-11-15_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxlogscore=845 clxscore=1015 mlxscore=0 malwarescore=0 bulkscore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211160053 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749638528563778651?= X-GMAIL-MSGID: =?utf-8?q?1749638528563778651?= Flag delayed_rmap of 'struct mmu_gather' is rather a private member, but it is still accessed directly. Instead, let the TLB gather code access the flag. Signed-off-by: Alexander Gordeev Acked-by: Linus Torvalds --- mm/memory.c | 3 +-- mm/mmu_gather.c | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 42f10cc1de58..38b58cd07b52 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1465,8 +1465,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, /* Do the actual TLB flush before dropping ptl */ if (force_flush) { tlb_flush_mmu_tlbonly(tlb); - if (tlb->delayed_rmap) - tlb_flush_rmaps(tlb, vma); + tlb_flush_rmaps(tlb, vma); } pte_unmap_unlock(start_pte, ptl); diff --git a/mm/mmu_gather.c b/mm/mmu_gather.c index 79de59136cd2..9f22309affee 100644 --- a/mm/mmu_gather.c +++ b/mm/mmu_gather.c @@ -60,6 +60,9 @@ void tlb_flush_rmaps(struct mmu_gather *tlb, struct vm_area_struct *vma) { struct mmu_gather_batch *batch; + if (!tlb->delayed_rmap) + return; + batch = tlb->active; for (int i = 0; i < batch->nr; i++) { struct encoded_page *enc = batch->encoded_pages[i]; From patchwork Wed Nov 16 07:52:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 20759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp12231wru; Tue, 15 Nov 2022 23:57:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf4zvnMPN4LtH2jgfs2e7Oikt41R3O6tl+k6tECGNQMw4hKpv15Y0ucBXdlYO5o/P+9J7nxF X-Received: by 2002:a05:6402:2483:b0:461:be33:ad25 with SMTP id q3-20020a056402248300b00461be33ad25mr18169247eda.138.1668585433105; Tue, 15 Nov 2022 23:57:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668585433; cv=none; d=google.com; s=arc-20160816; b=S24khAfYDSSleQm0E/KL42RjJiRtxga0jaR0GuQDmPBB4rxEUdmjVQY6S1H0qZDOfy B/gnsC/qWs3HaoG2bf3Imic770EAxlyhAaADjdTI5N5QonxQtsMuNixAV/DE8g3AVytG KbKohOQTK5p5adkEZvEWFh6kHeZGODiUCXRy94/7UlQua6DP/g9AqSwgDNoWN/XI28vM MWx/7VlSUOnbRmmQ0HSAz0/sBc8B3LUMG7M3S0nSrAPYmOpkT73IqWk+z1DMrYPasauH kPfHrz4VOcUKadfRIXlpK2qHC2hPCdnwwQfv0wvK3wjd4jPPrgrcRXvtoeBLhjhNlFOA DiVA== 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=EcA75F8cZO2aTdwdgrbcgF7SVITLfWHUdtAzo94G/J8=; b=haeHiPp1oMSwKiwX2YHNnQgBZ+yflyRjjfHHqmmnB0zk8A6iL+/fN5Kqt9Y0MNb4IW mrANoQf2zNcEtkdVmizxQ3aRt0pYPYv+G6CJZ2poB21bA8MGK8j3vPWx9mQoHlGtmbnM aDW0ZRXT+cq32b+dDT9uWL9mAvj4DcGrlJquD7AmDV3i0bSit6GKRMLoPWrdK4tJCm90 kMuM3eKH4PDJwiwA5IdhwPTTAIF8K+8TWIieypVV/yKLz1BSvBqN034Ln+G0Ds0N4hap gfE5AJl9kcB+YBDtNRhK1pUx4y+8wTqhupz8onY9mM9+jAQnuH7Xz0ClyA+GHfGpiuDk 9KEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=etGsHY18; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bq4-20020a170906d0c400b007abafd4d7d0si10659293ejb.702.2022.11.15.23.56.49; Tue, 15 Nov 2022 23:57:13 -0800 (PST) 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=etGsHY18; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231641AbiKPHxK (ORCPT + 99 others); Wed, 16 Nov 2022 02:53:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbiKPHxI (ORCPT ); Wed, 16 Nov 2022 02:53:08 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04F4A13D3A for ; Tue, 15 Nov 2022 23:53:07 -0800 (PST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AG7IFed025354; Wed, 16 Nov 2022 07:53:01 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=EcA75F8cZO2aTdwdgrbcgF7SVITLfWHUdtAzo94G/J8=; b=etGsHY18vF351w7Zc4BWolaFDclCASiFQ2qxcP8yoKeWxuX98/p6jDo0G1FveMRwXSDr GvnO2nxCaNHk21vsRbKIGMgIaZJOa8Cfueji6CL41FTtGVTzL88fsk4xMqn+li/2zLe9 h4wuYf+imtdanjaPHUF82IDMY5vZ9Q60tfOMlfTNmaezAVvi/anGUoIK9cEM1qoQOKKl m2Mc2x6XeNNHWm5mB81HpfjLQY147acY7bLyjcW92S04kEpWXBOxYTDnGoPMUOe+25dk M8ZSensmgz7fCk00pvkwZAkvgD+TAxkX8aaXVxgYcBWR7l4g/4mCIYm6mlXTY+th6+OS 4g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvubk8pw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 07:53:00 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AG7KMis031866; Wed, 16 Nov 2022 07:53:00 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvubk8pvh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 07:53:00 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2AG7oe8J020609; Wed, 16 Nov 2022 07:52:58 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 3kt348whsm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 07:52:58 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AG7qtYP3670712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Nov 2022 07:52:55 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E0C442042; Wed, 16 Nov 2022 07:52:55 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A2A1442041; Wed, 16 Nov 2022 07:52:49 +0000 (GMT) Received: from li-4a3a4a4c-28e5-11b2-a85c-a8d192c6f089.ibm.com (unknown [9.163.49.19]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 16 Nov 2022 07:52:49 +0000 (GMT) Date: Wed, 16 Nov 2022 08:52:45 +0100 From: Alexander Gordeev To: Linus Torvalds Cc: Hugh Dickins , Johannes Weiner , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Nadav Amit , Will Deacon , Aneesh Kumar , Nick Piggin , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Peter Zijlstra , Gerald Schaefer Subject: [PATCH 3/4] mm: mmu_gather: turn delayed rmap macros into inlines Message-ID: References: <20221109203051.1835763-1-torvalds@linux-foundation.org> <20221109203051.1835763-4-torvalds@linux-foundation.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: TjCzFlvACOESvlAtylpDdab9GpHaMHK3 X-Proofpoint-ORIG-GUID: NddfzGPYSXY_LoFYeBWMpz-zUn4Nd-fN 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-15_08,2022-11-15_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=718 malwarescore=0 suspectscore=0 mlxscore=0 priorityscore=1501 spamscore=0 clxscore=1015 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211160053 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749638639380970923?= X-GMAIL-MSGID: =?utf-8?q?1749638639380970923?= Make tlb_delay_rmap() and friend macros inline functions by using forward declarations, which allows defining ones after the 'struct mmu_gather' definition. Signed-off-by: Alexander Gordeev --- include/asm-generic/tlb.h | 56 ++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 317bef9eee3c..33943a4de5a7 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -261,13 +261,10 @@ extern bool __tlb_remove_page_size(struct mmu_gather *tlb, int page_size); #ifdef CONFIG_SMP -/* - * This both sets 'delayed_rmap', and returns true. It would be an inline - * function, except we define it before the 'struct mmu_gather'. - */ -#define tlb_delay_rmap(tlb) (((tlb)->delayed_rmap = 1), true) -#define tlb_reset_delay_rmap(tlb) ((tlb)->delayed_rmap = 0) -#define tlb_rmap_delayed(tlb) ((tlb)->delayed_rmap) +#define tlb_delay_rmap tlb_delay_rmap +static inline bool tlb_delay_rmap(struct mmu_gather *tlb); +static inline void tlb_reset_delay_rmap(struct mmu_gather *tlb); +static inline bool tlb_rmap_delayed(struct mmu_gather *tlb); extern void tlb_flush_rmaps(struct mmu_gather *tlb, struct vm_area_struct *vma); #endif @@ -338,6 +335,27 @@ struct mmu_gather { #endif }; +#ifdef tlb_delay_rmap + +static inline bool tlb_delay_rmap(struct mmu_gather *tlb) +{ + tlb->delayed_rmap = 1; + + return true; +} + +static inline void tlb_reset_delay_rmap(struct mmu_gather *tlb) +{ + tlb->delayed_rmap = 0; +} + +static inline bool tlb_rmap_delayed(struct mmu_gather *tlb) +{ + return tlb->delayed_rmap; +} + +#else + /* * We have a no-op version of the rmap removal that doesn't * delay anything. That is used on S390, which flushes remote @@ -345,11 +363,25 @@ struct mmu_gather { * remote TLBs to flush and is not preemptible due to this * all happening under the page table lock. */ -#ifndef tlb_delay_rmap -#define tlb_delay_rmap(tlb) (false) -#define tlb_reset_delay_rmap(tlb) do { } while (0) -#define tlb_rmap_delayed(tlb) (false) -static inline void tlb_flush_rmaps(struct mmu_gather *tlb, struct vm_area_struct *vma) { } +#define tlb_delay_rmap tlb_delay_rmap +static inline bool tlb_delay_rmap(struct mmu_gather *tlb) +{ + return false; +} + +static inline void tlb_reset_delay_rmap(struct mmu_gather *tlb) +{ +} + +static inline bool tlb_rmap_delayed(struct mmu_gather *tlb) +{ + return false; +} + +static inline void tlb_flush_rmaps(struct mmu_gather *tlb, struct vm_area_struct *vma) +{ +} + #endif void tlb_flush_mmu(struct mmu_gather *tlb); From patchwork Wed Nov 16 07:55:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 20762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp12658wru; Tue, 15 Nov 2022 23:59:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf4pHNgaP1dhh4oL4Z9oNlX9Ob3P8ibnaETqZKYy30Df06yLz2USDpCmBJiScelH7q0Sz4lt X-Received: by 2002:a17:90a:1bc6:b0:212:cf2d:4ff0 with SMTP id r6-20020a17090a1bc600b00212cf2d4ff0mr2542403pjr.132.1668585543723; Tue, 15 Nov 2022 23:59:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668585543; cv=none; d=google.com; s=arc-20160816; b=wATQHWuLSDG+S+eA+hip6tIjMD174E5+3b+Eu9ZLu5ofUqr4E7uzdBAGZY399typV7 Rt9GzTJ+uvkKu/+JG041905SvoKeWc/GDMXAbvypW2XtOaWfCxPcX6CY5nYU4vg0koaI t4tX4bN+VMQ9MoFVieRLO4aHkQqnOvblTKMay5/vuOX0Dt/oVgZwd2FbS4oxyNeRHWk/ J8D4bP/9MvVPwDmVv3/q8QQ3fN8HieDNmWx12P0rJDCplopeentX87hGO0gg6ikXaC0O etVjvqtl2rlt0LJkK1hNv6JTmitbZe417f4iRE2X2l7gTl/niZNMMQsl9kUEUPyH30Ee yUrQ== 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=zxqPjpCi3JcyOanxgzeAkaLI2bCjiEEcYtFfqwuvnrU=; b=FHoqdzl43boOzmAVlQ3EKR74Z9BTreXmREGBWryNe2IpdeKlkNoB+mZsmzaivaxuiG Egabp6Ira3jM47aRbTR8Bl/bgMaO10TAXGRClMsz+SV+GDN7BcMq3hOZS/K8wxDIkqob GOuCHoBw96yIErrA5ajInAIKjHlvLobVvm7FQRuaW3vUYUjh2d0SXKNXjUS3N+e/NPlf HfSP89Mp4Cr6Q8pBoQWlzBW9P5wAKLwLNghkELhB9woN8kpVbCfHu47vFkQLLVEmRVm6 6d6k0tPTIQwtGG18hqsCe1ZETbnufwAR/7++Qj4+pOIQzPWRCajjW2VHfkdbVN3k8eZT atIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=n4Vo0aDH; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a170902b70900b00188abb90283si691963pls.435.2022.11.15.23.58.50; Tue, 15 Nov 2022 23:59:03 -0800 (PST) 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=n4Vo0aDH; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232431AbiKPHzo (ORCPT + 99 others); Wed, 16 Nov 2022 02:55:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiKPHzn (ORCPT ); Wed, 16 Nov 2022 02:55:43 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EA0211451 for ; Tue, 15 Nov 2022 23:55:41 -0800 (PST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AG7I8Ro024283; Wed, 16 Nov 2022 07:55:33 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=zxqPjpCi3JcyOanxgzeAkaLI2bCjiEEcYtFfqwuvnrU=; b=n4Vo0aDH3U1ntnxD7IUZ4WPQ1sNHUfKKRpIazXNRLaybUrNe9aqHGQQu3Z/oKWFXOEyI AwwwGkjysmdAzIm4wrH9vv+JFoQtxgXkaQ9WSDMk4/ZC1hvdALgw8l0yZ7Oa1m88YaHr R5ew9wRN9n22V+hcRcTLGK+cFiVRbrI2JX5KxsG4BC8LaYb6/zhNR2xbX23XyymsAxEA LfOVhjgy61K/b8plgdHs3OENn9UmbF2kufCjDWARHIySGQVU+7TcIhcyVN0GzCeDOZWx eBQd7HMamqdwFBqihwBaiP5xAAYZGYTaE2Lynjnjflt+qY4rXxxUzQZJiV1gmR2Plugr rw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvubk8rb6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 07:55:33 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AG7JUZa028413; Wed, 16 Nov 2022 07:55:32 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kvubk8rau-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 07:55:32 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2AG7p1Xg016669; Wed, 16 Nov 2022 07:55:30 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03fra.de.ibm.com with ESMTP id 3kt348v421-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 07:55:30 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2AG7tRo439912076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Nov 2022 07:55:27 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D52F4C040; Wed, 16 Nov 2022 07:55:27 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E4D7E4C044; Wed, 16 Nov 2022 07:55:21 +0000 (GMT) Received: from li-4a3a4a4c-28e5-11b2-a85c-a8d192c6f089.ibm.com (unknown [9.163.49.19]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 16 Nov 2022 07:55:21 +0000 (GMT) Date: Wed, 16 Nov 2022 08:55:17 +0100 From: Alexander Gordeev To: Linus Torvalds Cc: Hugh Dickins , Johannes Weiner , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Nadav Amit , Will Deacon , Aneesh Kumar , Nick Piggin , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Peter Zijlstra , Gerald Schaefer Subject: [PATCH 4/4] mm: mmu_gather: rename tlb_delay_rmap() function Message-ID: References: <20221109203051.1835763-1-torvalds@linux-foundation.org> <20221109203051.1835763-4-torvalds@linux-foundation.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: u61HFfB8v8CpGA_LHireVp_uCMsQZ7Fu X-Proofpoint-ORIG-GUID: 2bT4bnP3VomTt9cMFUa1muWeD4iWKzHS 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-15_08,2022-11-15_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=814 malwarescore=0 suspectscore=0 mlxscore=0 priorityscore=1501 spamscore=0 clxscore=1015 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211160053 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749638755067611437?= X-GMAIL-MSGID: =?utf-8?q?1749638755067611437?= tlb_delay_rmap() function indicates to the TLB gather infrastructure that a particular page should be removed from rmap until after the TLB flush. Yet, the function name and prototype indicate the whole TLB gather state. Rename tlb_delay_rmap() to tlb_delay_page_rmap() along with delay_rmap local variable and avoid the described ambiguity. Although unlikely ever used, add 'struc page' argument to the renamed function to emphasize the notion of the page being delayed. Signed-off-by: Alexander Gordeev --- include/asm-generic/tlb.h | 14 +++++++------- mm/memory.c | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 33943a4de5a7..2c425acdd2be 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -261,8 +261,8 @@ extern bool __tlb_remove_page_size(struct mmu_gather *tlb, int page_size); #ifdef CONFIG_SMP -#define tlb_delay_rmap tlb_delay_rmap -static inline bool tlb_delay_rmap(struct mmu_gather *tlb); +#define tlb_delay_page_rmap tlb_delay_page_rmap +static inline bool tlb_delay_page_rmap(struct mmu_gather *tlb, struct page *page); static inline void tlb_reset_delay_rmap(struct mmu_gather *tlb); static inline bool tlb_rmap_delayed(struct mmu_gather *tlb); extern void tlb_flush_rmaps(struct mmu_gather *tlb, struct vm_area_struct *vma); @@ -300,7 +300,7 @@ struct mmu_gather { */ unsigned int freed_tables : 1; -#ifdef tlb_delay_rmap +#ifdef tlb_delay_page_rmap /* * Do we have pending delayed rmap removals? */ @@ -335,9 +335,9 @@ struct mmu_gather { #endif }; -#ifdef tlb_delay_rmap +#ifdef tlb_delay_page_rmap -static inline bool tlb_delay_rmap(struct mmu_gather *tlb) +static inline bool tlb_delay_page_rmap(struct mmu_gather *tlb, struct page *page) { tlb->delayed_rmap = 1; @@ -363,8 +363,8 @@ static inline bool tlb_rmap_delayed(struct mmu_gather *tlb) * remote TLBs to flush and is not preemptible due to this * all happening under the page table lock. */ -#define tlb_delay_rmap tlb_delay_rmap -static inline bool tlb_delay_rmap(struct mmu_gather *tlb) +#define tlb_delay_page_rmap tlb_delay_page_rmap +static inline bool tlb_delay_page_rmap(struct mmu_gather *tlb, struct page *page) { return false; } diff --git a/mm/memory.c b/mm/memory.c index 38b58cd07b52..5ba4a1f94688 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1374,7 +1374,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, break; if (pte_present(ptent)) { - unsigned int delay_rmap; + unsigned int delay_page_rmap; page = vm_normal_page(vma, addr, ptent); if (unlikely(!should_zap_page(details, page))) @@ -1387,12 +1387,12 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, if (unlikely(!page)) continue; - delay_rmap = 0; + delay_page_rmap = 0; if (!PageAnon(page)) { if (pte_dirty(ptent)) { set_page_dirty(page); - if (tlb_delay_rmap(tlb)) { - delay_rmap = 1; + if (tlb_delay_page_rmap(tlb, page)) { + delay_page_rmap = 1; force_flush = 1; } } @@ -1401,12 +1401,12 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, mark_page_accessed(page); } rss[mm_counter(page)]--; - if (!delay_rmap) { + if (!delay_page_rmap) { page_remove_rmap(page, vma, false); if (unlikely(page_mapcount(page) < 0)) print_bad_pte(vma, addr, ptent, page); } - if (unlikely(__tlb_remove_page(tlb, page, delay_rmap))) { + if (unlikely(__tlb_remove_page(tlb, page, delay_page_rmap))) { force_flush = 1; addr += PAGE_SIZE; break;