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: 13044474 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FA92C433FE for ; Wed, 16 Nov 2022 07:55:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 96FBB6B0071; Wed, 16 Nov 2022 02:55:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F85E8E0001; Wed, 16 Nov 2022 02:55:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74B0F6B0073; Wed, 16 Nov 2022 02:55:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 5F76D6B0071 for ; Wed, 16 Nov 2022 02:55:41 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2FFF41201B5 for ; Wed, 16 Nov 2022 07:55:41 +0000 (UTC) X-FDA: 80138546082.23.35159BA Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf19.hostedemail.com (Postfix) with ESMTP id C24741A0004 for ; Wed, 16 Nov 2022 07:55:39 +0000 (UTC) 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668585339; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zxqPjpCi3JcyOanxgzeAkaLI2bCjiEEcYtFfqwuvnrU=; b=6M/jIpIP/jGUVWXJhhTsQjABei1Y4XRMYgxDgylsuuPbSyflo04+PqlxK0UEmxjHZOH7Rz yrTxuavGGnSVAO1EqyE3b0r2vctrO6GYh/PY1lchPHweONi7kMGJX/w1rxz8v4Ekjlos79 KEizdQ9DtFzH0L0DMnH0NJiJyGdq4Rg= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=n4Vo0aDH; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf19.hostedemail.com: domain of agordeev@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=agordeev@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668585339; a=rsa-sha256; cv=none; b=5XCsHvaBLKTETNjYVDk85n0ZdemZM1tSQMcNe+l2BYVAwqVugpN209npky0AZnqgBTDvtq C4yvS6SGWD9RKRU4dWEQC+dsyzcVz/OrwiZBR4WU6hZdr8n/hxcXDAtk/hmJ8ZkSNTnqxt GfpAmp68wUbIdaDiH75JSJuOicadgKA= X-Rspam-User: X-Stat-Signature: raqqpnbxcjdxkqo85ujh578n7iz5wgxu X-Rspamd-Queue-Id: C24741A0004 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=n4Vo0aDH; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf19.hostedemail.com: domain of agordeev@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=agordeev@linux.ibm.com X-Rspamd-Server: rspam07 X-HE-Tag: 1668585339-672844 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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;