From patchwork Thu Aug 15 08:31:01 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Huan Yang
X-Patchwork-Id: 13764515
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 9C4F7C52D7D
for ; Thu, 15 Aug 2024 08:32:01 +0000 (UTC)
Received: by kanga.kvack.org (Postfix)
id F31566B009C; Thu, 15 Aug 2024 04:32:00 -0400 (EDT)
Received: by kanga.kvack.org (Postfix, from userid 40)
id EE1846B009D; Thu, 15 Aug 2024 04:32:00 -0400 (EDT)
X-Delivered-To: int-list-linux-mm@kvack.org
Received: by kanga.kvack.org (Postfix, from userid 63042)
id D5BA46B009E; Thu, 15 Aug 2024 04:32:00 -0400 (EDT)
X-Delivered-To: linux-mm@kvack.org
Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com
[216.40.44.16])
by kanga.kvack.org (Postfix) with ESMTP id B8C636B009C
for ; Thu, 15 Aug 2024 04:32:00 -0400 (EDT)
Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1])
by unirelay03.hostedemail.com (Postfix) with ESMTP id 3F6A4A1371
for ; Thu, 15 Aug 2024 08:32:00 +0000 (UTC)
X-FDA: 82453812000.10.82EFCD0
Received: from APC01-SG2-obe.outbound.protection.outlook.com
(mail-sgaapc01on2049.outbound.protection.outlook.com [40.107.215.49])
by imf08.hostedemail.com (Postfix) with ESMTP id A5E6C16001B
for ; Thu, 15 Aug 2024 08:31:56 +0000 (UTC)
Authentication-Results: imf08.hostedemail.com;
dkim=pass header.d=vivo.com header.s=selector2 header.b=WyuUO3nU;
spf=pass (imf08.hostedemail.com: domain of link@vivo.com designates
40.107.215.49 as permitted sender) smtp.mailfrom=link@vivo.com;
arc=pass ("microsoft.com:s=arcselector10001:i=1");
dmarc=pass (policy=quarantine) header.from=vivo.com
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed;
d=hostedemail.com;
s=arc-20220608; t=1723710704;
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:content-transfer-encoding:in-reply-to:
references:dkim-signature; bh=I/HbH+lqCRD7KxTiNVT+iMr7LtMJnifp7MQgXFCwqt0=;
b=Hcr2pbpy4E6nnMj/WlzmTPG2p05Qwn8LlWe0WVwT6lG5PfhIgB7qpDNdG0Qt7+xMzUGC3R
VxzDL/TnolOnEBXk25CYO28VUQWiIA8+y3UtIY0NpawRNx+XEpUFq5bjMPR6W3ftZsXj4c
ue/lC/Lw6H9TkNkq6I/347laGdvjaws=
ARC-Authentication-Results: i=2;
imf08.hostedemail.com;
dkim=pass header.d=vivo.com header.s=selector2 header.b=WyuUO3nU;
spf=pass (imf08.hostedemail.com: domain of link@vivo.com designates
40.107.215.49 as permitted sender) smtp.mailfrom=link@vivo.com;
arc=pass ("microsoft.com:s=arcselector10001:i=1");
dmarc=pass (policy=quarantine) header.from=vivo.com
ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1723710704; a=rsa-sha256;
cv=pass;
b=Qw5A3Y8aFotRj1IUFg3LNww2/bOnPjS8HiaXF9E2qIuHq7soahqURv+88xr4ATE/+BSb8X
wK3XZt1GGVrbgmXYr4jbDPB/NuB+T7GzTiY54MV8VHdkH2LTZPGuN8Q3crxvv35Y9nu92y
QKEqhKUZiXb4MUAW3rW4fB441Nyl2QE=
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=ZSYHykAy7lOrqdulq3G2j/sBZrY9fi3IItROfO1BVOnEAg/AJ7waCZBPugj8pi+8X5j496F7Ij6Zw+6Ag1dESa7qkRKPIaJ7YR4IObhoR12lQXbz/JI1yToiX13XFDEjG2xmqCmtD7rz1SmvjPKt0sH3S9uJ7Guv9BQ1rp+1NiwDUKWNOehjFPNiKE9DGT2qOiiFVENdUAdpCQxEFjyp61YJq5MP+6gLRFTGiB0JQYcsMOGKt8Oq3YKOpL74x2XEx+d11Gb2ETDmDkuPsHCow5G1Re+Qkk4CP0ExU/f8A7GHMu6uCg5S9iZ2xSSjO5H0Xgv3qJTYgmhIub9llLQzkg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=I/HbH+lqCRD7KxTiNVT+iMr7LtMJnifp7MQgXFCwqt0=;
b=PBTltKHhFu6piQbCGsSQziwHTy/y5QTg/1rEUCAZ/koh8Tk4WA3G8lPpDisJDlTXp0xENldgw7+j8JAzMqqDuzpfUsrT8qulJ409hVR6Ht+7YqWUUXCs5nJZeBdsg2zH6pMDfkwxaOm5/+V2+JxLYNAa3MRqik/V+7ziwDgNc662pVph1gOuTT2jfjlbjDW4yPUlUbKQIkb9PhEce4FD6wtDwbfUAF0W1r0Y63pst0VZG7zBJkDj8p9lldD6Vi8HThq5ojGbh5xpn7AnL4gcBsWpwcuiq801vRUU7+xyLEAisX5wWW6KFcGUNkxFTfWTIg+zHb6nW8CbzMaQfZ9sSg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com;
dkim=pass header.d=vivo.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=I/HbH+lqCRD7KxTiNVT+iMr7LtMJnifp7MQgXFCwqt0=;
b=WyuUO3nU5/S0+8sdk1wGdtscRrhk3GbtOKKwSnroII3ZqAnITimIBAuUHG+QDWC88kNA212fIjXigCVo5vI5i7S2JUZh4j1oqrZJveWUg8EBgK+FPTOGfU6WwetLcVaQBX8Ms8tq0oHxllLS4Jrih8Wq/zXDlL4VoZtCF/AJvmDlo2LZYaAnyg/Lp1TwCfumiaHz2K8HMII/efs8Xo5ZhGt3O19+te6wHp40yc69ouShEnTam8Mlmoip+zQUATMreVU50HXiNqdDsDTxbCj+B7Os5wAGVOeggzYeexMuVSrPADYV514kiy6YpwB3MFjgDTSBKsQGpw1WOXyM+qZZWQ==
Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10)
by SEYPR06MB6376.apcprd06.prod.outlook.com (2603:1096:101:122::7) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.18; Thu, 15 Aug
2024 08:31:46 +0000
Received: from PUZPR06MB5676.apcprd06.prod.outlook.com
([fe80::a00b:f422:ac44:636f]) by PUZPR06MB5676.apcprd06.prod.outlook.com
([fe80::a00b:f422:ac44:636f%4]) with mapi id 15.20.7875.016; Thu, 15 Aug 2024
08:31:45 +0000
From: Huan Yang
To: usamaarif642@gmail.com,
yuzhao@google.com,
Andrew Morton ,
linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com,
Huan Yang
Subject: [PATCH] mm: move the easily assessable conditions forward
Date: Thu, 15 Aug 2024 16:31:01 +0800
Message-ID: <20240815083102.653820-1-link@vivo.com>
X-Mailer: git-send-email 2.45.2
X-ClientProxiedBy: SI2PR01CA0042.apcprd01.prod.exchangelabs.com
(2603:1096:4:193::23) To PUZPR06MB5676.apcprd06.prod.outlook.com
(2603:1096:301:f8::10)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|SEYPR06MB6376:EE_
X-MS-Office365-Filtering-Correlation-Id: 8d3effba-cddf-47d9-8910-08dcbd04b29b
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|366016|376014|52116014|1800799024|38350700014;
X-Microsoft-Antispam-Message-Info:
GT3leGEl6odkCYBn9bxEnWE/74+6aH/UWCDox+sf0FzwL2OApi6/DQ+HcuUP0kauypAvB5ev4Sh9MqmsciENATXL6Fo1+nyuAPAjUUqhwC4dkbfSh7g8u0E7LcTwZ9P9f9Uxfo6YVWu5x5mpnlsS1ODtXxwcUCuww/RwHtnZvukroMHEqGT1wK+BI6B62fVbLmcIK8gSVUajYe0gdKYl2ShLhs5q4UDXaq2CDRkclGqfz03A7niIXWh+yYAlhDZP/QDYql1eQkjtFrpuF2asJKQPCdNBOYVVLnFrl3zaiLJGAjgVryOqHoVmMDg9UhcKibF9Omwt9RnT46W+78XzHN6mi+a68vZeKTyf6pJ42D8+gFDAoUzMVPTlP+c6CXjmCfF0yUIx3kKe8dAP0o/pA8QsPCL16uhuUA+LSmMHUKEC3ZhKpHEs8jM4r1BzJD4w17coeghpWF+8I+hNefk0XVO7Jz7UV+bkYgCdPe0fPqqBG/tFriesBQ4gWW4HdkfoybTFUpI7UaNb9qWpDGK1jU+gjGSklf2s/U5WOYL8Intb0ycbyo/+ANDGBF/sdUxQBVm0ZPCgSQ3aU5SJHfTmvyvQrEISV9oHmbjHgbFmniRsmphPVUSmbeskAbtjMWMfa8w+VLGQBfcwwF5TSaQgOSxIM0PaRVbQajYJzYvksCJMg5A7Ey0isePpcJ4pBEs/2M35ywBTFBTaDcOondR70wkfElmJChkCboi0UkTMNPCNR1VHAf5FByCJcE60A4eUAnQadzytytcxhvDGUSWV4myjem+BiObw2HaH1ftAZ0ACxWFligJmCiIUz3xtlDMB9o+dsQsXdsxMVCpmZ6eAM+cr4uTugEHpYPPqTRJGnet/Q25LHOHX+Ep8iiIqpuZahzqWsLDSXbmKYklFVAAUp1kjKfpM5bP8lzr0pfVy19xhxoCHeCdM5CyztBlocv2GH2itKnulHRpPlOMRksYb0BGdewNDmXwEYhabCfQmTQPXTCPSc3kLQDnT5BkFyn3+NvNU5rAbLV0YB/napv9pHjbFbP1B3hEChFgUSGvvvsbHERbTJfrEM9aiocRfn/ralzSkK0LaTqHIKcWEoPVMJcSkoF0mpblFaUQd9ZPYuG3e1VM3t4Ynk1TcpxhY8+Cdw2PHhlALgnn6CGMOU6RfNCo6fjwSGvpIhUqV32b2+BQBiP1kiPZKboAZBH7BuTSoF9yfWyKJ7sQ3HmwDI+NF4ViiYf8sY/JC1CJiBk62t4Wo7UcZSx+3OduL47zwuX+GpnBIAv4Wb4++CNOb9LOZQMfdhed2X3VJ6V79r5JkBxRo495yesRo6Zxr1Jrd6enxNh0qId/rnikUiw6tkO3sDwsm2eEvbckluc8wefff8q9SsMHwbpn9vp3KlDssJgg1+3V+ISm2wnn3F9YYhD+0Yw==
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
VgAVad5Jzn1kZ0f51fBomYKiWJsOF1bvVJEbqo6DdSYDcQnD8zuy6wiu0htshsBUWXeEhWaQ9nGRfbtkZzmqqiBNYJhzm56wQNL2JjSQRwMOaUVfajy8oKypipc9pNaWveS+9yFiilFZn7HbqgIhRHyLvvM+uSzKxrtQt2sLXnrs70d2W9rBG4inTmWYZ34YUhInNQkH+y6MB0R7jWeKwKQ6JzvecQzuE4uINU05W9buNl62WsMGNUULT0LAE6qq7ii/BfwFaAZQblAe1OX9Yy81H8fm4WA+EDsE2t+e+XyvI90vuD0yXmH31kaY6/dml2NrDLyRkP3cE/pJqjPNig4kO55A8k3Goc5DKNPUfA6rSV18AAoX/nVDEsw+Sn0Udm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YNVT501gw62snCj0ozpXgFb8W/yacH9BU6eYT5MYCBEQhFiQTvzL5Ovkm/x8h7itb5iG6zDQeoIdz+ByIC3foDPLV6Fqeb7xjISLRfo3vYeoU/WDT5yaZGhXvk2xiujUexzjTum5S
X-OriginatorOrg: vivo.com
X-MS-Exchange-CrossTenant-Network-Message-Id:
8d3effba-cddf-47d9-8910-08dcbd04b29b
X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2024 08:31:45.6176
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName:
hvW9+QH5i9/Ke0W2fTe1pvKzW0xYYMzBSTPHKODVG1teWgBEnRok/yaxsV7/YrHc+GWsVDlAil9XiQ4a4nu0Fw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6376
X-Rspam-User:
X-Stat-Signature: gsjouea96y4s31m7r1q5gy96qy9t7qhn
X-Rspamd-Queue-Id: A5E6C16001B
X-Rspamd-Server: rspam11
X-HE-Tag: 1723710716-283354
X-HE-Meta:
U2FsdGVkX18iylmcA4XdJ5x4BCzHLSUWlW2hWWAPzPIh9EFxxYDQpJGEAvo2uQz6O27A8He8EDMR/VirObW/3BVDxt2nIzE2DA1DisMv4ad0cCCGsMvMVN7SSRmUFv5e8Qrhym7zw5n9PYRFiEIrHw1sx35Kd28nURpaFopTG2vKiLY3fH77KXPyLbr0rfVfUGtm01OJ/bvaBrRp7Cfu7LDtIulcnri204/WMTfS+0GWIE41NiSFY5GQ6He/Bcr3KxAW+zTWbYS3pldgkHW3T/hnzAcwyaY0xNZHI5tPQoxgPMkn8a7qB2+W4v9Qxs4v8T+jBB7o4MSZtC0xPn1D7m7gNpgskahNOEMNcYNxliX8hhznONai9sI9IpxvEutqMvQilyvQHiicxjjRLzkTvpuYJGUS3nlePnAcprlu4CX7CZYEuCpauFGQeq645fiUB4d+VGpXMJuy9lZBok39p1bbD7xL7P8KPTP/WP6+3WZTLCqSKvlMjJfTW2pg6mIudyciEhWWSg7w3Xf9SVioefTIRXjqzCkxl8lxGlUAGAGVcHXHYAv98E0Zj5jG6D62roIHFZzP5Q9hs3w0BS9+z1lYdtax6ytpacjvVNnJjGpgxlMXvmSWwQS9XhdjoWG6r/EYONDuLiBeBdtXYl6ghzO4Bf+qD2aBST+GZFkUhIKAHiq28iZcYAWxdNfGFEZzN80yten81FlVK5r00w3cSbwxs/M570L72YN69ER+BUfujWvPdgH6XL49JhfYwp9yfpydM6C7bff+9VRLD+aSL0Gjq5Sk1MsQ8yPC2soFBNdlAg7+cccmAQBD4xFm6uV1u/4T3tgCHXoEH/zXc6pMEbMk+8oMgYSZSaGT5BwNJGyehZYKCcHjc85jYoeH29PWoy+Cl7HtEZSqRpbkthcSj0dyCOHMCJ1kN5h/YpQvlJBt3qN6/UaCNTwX8tAlrJFE/WxmOAogA5F3HC2ID+u
8RESfWoP
PvLdKcQqAWnUwWKIIoKfy1MvKG5IknZgQqCAa7Nu8rcqoj5/NL9xSfNa3Qy7C6rUwPwc3mXyGo56kSZd2ABT7bG/jh8jIfzyyCCAddXKqnSYSHYGbOSatsiTp4/TNB06pu60j3gYxO7XVcor38VlYzn4QuevAgr5AbvoUhYPet//Ot7DyuB1ZoOmPdK98x5jPKyxp3EhU7/w8c8EDhml6JNf3YzwaI09pX23ZXlerqiF6xivlDPO5FTD6v9619F7EPCPsfdzJd73vaAMKdK+BSX7mb2/Y9F14Vsui+BNmnJ8wRww=
X-Bogosity: Ham, tests=bogofilter, spamicity=0.044211, version=1.2.4
Sender: owner-linux-mm@kvack.org
Precedence: bulk
X-Loop: owner-majordomo@kvack.org
List-ID:
List-Subscribe:
List-Unsubscribe:
Current try_to_map_unused_to_zeropage try to use shared zero page to
save some memory of sub page.
If forbids zeropage, no need to do anything rather than attempting to
assess wthether to use it afterwards.
Signed-off-by: Huan Yang
---
mm/migrate.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
base-commit: edd1ec2e3a9f5de7fb267a3af73e4f00e7e052b7
diff --git a/mm/migrate.c b/mm/migrate.c
index 6e32098ac2dc..d71cc4ff190f 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -192,6 +192,9 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw,
VM_BUG_ON_PAGE(!PageLocked(page), page);
VM_BUG_ON_PAGE(pte_present(*pvmw->pte), page);
+ if (mm_forbids_zeropage(pvmw->vma->vm_mm))
+ return false;
+
if (PageMlocked(page) || (pvmw->vma->vm_flags & VM_LOCKED))
return false;
@@ -204,7 +207,7 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw,
contains_data = memchr_inv(addr, 0, PAGE_SIZE);
kunmap_local(addr);
- if (contains_data || mm_forbids_zeropage(pvmw->vma->vm_mm))
+ if (contains_data)
return false;
newpte = pte_mkspecial(pfn_pte(my_zero_pfn(pvmw->address),