From patchwork Wed Jul 31 13:33:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhiguojiang X-Patchwork-Id: 13748805 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 44A63C3DA7F for ; Wed, 31 Jul 2024 13:35:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D61CD6B0093; Wed, 31 Jul 2024 09:35:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CEAD26B0095; Wed, 31 Jul 2024 09:35:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B15A16B0096; Wed, 31 Jul 2024 09:35:27 -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 8ED666B0093 for ; Wed, 31 Jul 2024 09:35:27 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 469091203A7 for ; Wed, 31 Jul 2024 13:35:27 +0000 (UTC) X-FDA: 82400144694.02.ED0AA5D Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2055.outbound.protection.outlook.com [40.107.255.55]) by imf23.hostedemail.com (Postfix) with ESMTP id 5CB9B14002B for ; Wed, 31 Jul 2024 13:35:24 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=mliT2B7+; spf=pass (imf23.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.255.55 as permitted sender) smtp.mailfrom=justinjiang@vivo.com; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1722432896; a=rsa-sha256; cv=pass; b=H4c3mPd7VLNJF9A1ViHhnCsfuGWL7Vs7WWu6eipmUwCT+5COf58CduWgZa/a7pRYOBxdmQ ynpexQb3VRvHXuWdPN+KMCtxYpXDHgigtKOjYY6YFfHX3rwOIGRcV4NZDlnDHPAd3AutbG 0IR+EolOemRUCnRCOPHgjxq0xuzfSyU= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=mliT2B7+; spf=pass (imf23.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.255.55 as permitted sender) smtp.mailfrom=justinjiang@vivo.com; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722432896; 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:in-reply-to:references:references:dkim-signature; bh=lyxFrc6Clfrofhrb3kvsAmejA25jBTP+9YIvp/aeLhU=; b=VFDgMAqwMndRu7QPAUOj5ic8XXVrkIVhfuDhzNc+x9S6ukmOlifvfJpfijhloWJuivxqtm Y1FbJmY8wnJBndMdfZSW1Tv/YKO5kCMET1YLSNo87fQaXL9YOinq1JH7ydi042VxOJqkRs /WdPJz6ILKpu53dkiIHVbsPt+zQo8ak= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wyg155LufuVX4eGFF/0cX0V3abhdfgQa1lnTMNA0Uc96kQDO4W49Ke0cixnSt+vQ0WE56oS1sM0LK2O8B75UVfAcDbf4WbPJ+88sjCh1JbJk74aRYw1MEdit9CCGq/bS9pQb6EEu14KdhKJrMrAImLRQ72YFYPdC1sU2x/IBKkTp9imp3E0aZPvIB4qEsxNMKSlplY9c3Pp6F2FdrelsYs1Rjc+ESVWq5dFgg8sfqtfI6ENfVHxZRO1iAXwm64cKT8LXE+FM0mEDUYUrI75jIMqMtlSji8cdu/t7ELnmzJ2trrhfLjG75JZR/uYMVf22ulyQBdp9EQfE4QVf36Gy3A== 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=lyxFrc6Clfrofhrb3kvsAmejA25jBTP+9YIvp/aeLhU=; b=hxWM9XcSAJTzsa97wiINYEpO6p66Vqq+HbbtuiSblvdw7hWS92TFKxeikV1unI7oPx72ZrHsP7UJpqxDoazSdsMfJCqud9vwRlNoWxYKTOfdKDuKlY61kqOtbsICBqY4M0+NHMH3dpO7iLNgb5tU50oHeNHlSqzIkf/KP7QVnkU0OkKZfYq4BSiqDb44U/+DnJcJkgke8nN1sZ7NC2TzuIsjYPED+z+7/z/rScDLDvm+FnvknTtcqWemAS8cHnEWr9riFu7I6yj32pZkW1mBMZzXrMnoCfapCt3kaWxeZHlJMDetx2/NWaco3jFLlTMfNSIKFR0gWsw4y0QOrVjrPw== 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=lyxFrc6Clfrofhrb3kvsAmejA25jBTP+9YIvp/aeLhU=; b=mliT2B7+DK5nLl1qGxYmhcmtArAFoDwiIUCYjr2KevP/VQmrOY/3ivqJXzg0mcikQxbO0B9QZPUhIUpk/fl101zdVIp9HmWzLFfWI0U3PWFlqPS9tTtNHp2KNXfujA9IxZ3+5wyyc9YjDPRl8WNmuluH5PRgJkpP1vOJIX6N8Btjvsyu2nstoPJmS3KvHcL7hsS0EiZplQyF0WMuYLElv5/cXPe1b1+zaAHbBv/PxpW3AldxuHnnmMx1Vz5kHVa0xp2oKfIMm4xhIW+HIp1xNMxN2JjJQ4HY9cIy2Rf8hVEon85LWj3GVMQ2wNGB5JMUTKAoIlREieRaQUbQGKkVEw== Received: from JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) by TYZPR06MB7334.apcprd06.prod.outlook.com (2603:1096:405:a4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.27; Wed, 31 Jul 2024 13:33:28 +0000 Received: from JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::ed24:a6cd:d489:c5ed]) by JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::ed24:a6cd:d489:c5ed%3]) with mapi id 15.20.7828.016; Wed, 31 Jul 2024 13:33:28 +0000 From: Zhiguo Jiang To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Peter Zijlstra , Arnd Bergmann , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , linux-arch@vger.kernel.org, cgroups@vger.kernel.org, Barry Song <21cnbao@gmail.com>, kernel test robot , Zhiguo Jiang Cc: opensource.kernel@vivo.com Subject: [PATCH v2 1/3] mm: move task_is_dying to h headfile Date: Wed, 31 Jul 2024 21:33:15 +0800 Message-ID: <20240731133318.527-2-justinjiang@vivo.com> X-Mailer: git-send-email 2.41.0.windows.3 In-Reply-To: <20240731133318.527-1-justinjiang@vivo.com> References: <20240731133318.527-1-justinjiang@vivo.com> X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: JH0PR06MB6849:EE_|TYZPR06MB7334:EE_ X-MS-Office365-Filtering-Correlation-Id: ea452106-f2b6-40ab-a08c-08dcb1655cbd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|52116014|366016|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: R7+Gq8enhSWUiHDdpLEDJfkl4ilHVQVdUr1XKj9MG7b9tzwF7GYT8hSKeKAjQ8X0tBHcIyA7mD0qD4m2pqansTNG1xArGa5OgAN0lEePSJepdFt7tDRcAi1GHoczXZpomW/ez2wkbg4C9b/+Rh7ZYOn5BbI8SEJ04p0ijOBnHmlSzUfqQnhm2gfhQ2lrh+N2Cs/n2B7bp9QBIQeJVYMgsVfhdI9/CyBjOyMAwO3qQBO6BPKaF3gL9gd5FN4nkdUTjEfwhw3iutRWQwobI7Gxz2WJRGWQwC33hV213knlIIL7ubI8ZTjnK0Bo4i0BqCYvz6vILHEGX4+EHQIQlESniXKBrcSLWp5BJ99w/CD8nIAcfobaW67jmADPAOe6DoONW/fOybRX57CxsFZVB9TXCY2cohXLM/9kNQbVZG0VrOGJOtAPoH+YMHVuYudonpspri0PIe/pCajLUDyoEAfi6N7wqEhAekQsiP/uAs7sR8tW0Y+tStBC/hs0BD6yC0beaHhjZRUaFkcPx4l3M200KaIcoxU82XnpVTmT6m/V+1rMyUgDmkOtStMci3+DETDkCCyxV2W35V1VfVnS1nRP03rPYLCz15s++3zDAFuK2SQYNgx5fI4O8rcIp/aQk7jB5axUcL9DM4AIwM0FxFd1obwW7mUpg6U/+8HbDwPbNJxTDypzvq2MBVSE1iuGgJFr0lxRngZtxbvqbAmWx2xTcHLHVQF3lq4tzqAw3ZxLpSlBhpOAhyY4w+kPyqSKK3UfcDgqLPVKBfOmrOusNCJ2qyX6ZGW6b6dR6jLofve9jbF+y1CiGuk+kVb/y5Z1ABYYpVztQ8D5fWN1SFJU5qGg1MoOS+JzX+3asr8QD1O0AC2aF69B/6CXYHX0VLETzjt5JvPYRR+yHQ9Ohr+qmXz2erfy3lm34Z7qtNg+AKEws3C5PHdcKAHa+/k7lg78FzYTq84cK6Pf1nTc/2m18FtSvpQYTrGFD9aSc1NthUWRcOowPO+NDtaZhWEvd48NIQsZrnA6osHwabN1rVhYA5+/SXwH1/2KI28vcr1vuDkuSsrWbe4HNdCjFm9rA4elqmSB748yWeORsWBO+LGORc8mrnjkRM4EqIvvh+fXhasumLIOESoBEGf23ekLj71Ey7cvgDtGnrECFztGPgksOnSrXDb5bWhWKmFG0Bp0PjAiRwuzaYhlWeufL3pU1FW7OZU3mPx9nbm90a86Fj2cRQp7IWh2wk9qJE585CNM+2sKyRCQ269gifz+266KShRidA3noOWwefa/S8XCluqDmP4No71k1zSZOAfs0nehYwsvIJF+8NV9B9FWS5qa9AKsmp5L5jKxAEtW1KWOw9RUI9uxq0gGwdnqMzaQAzXPGGHKlphrPS6chZ66o5KIOcEEVAVJ+waFjmDoY7eUUEkCW2jm/+AtOZYGFgWCAQFLa8dw8Ug= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:JH0PR06MB6849.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(52116014)(366016)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n6Uy8ZX8UOw9LR60+E3DJH3zgWAXiCDvb9Z4fgYcXXrN2L1qYTaB+/shsEjHMTka+MV8ULkBzEVgPUxdG6l8lCdd9XvS7KwRW6NR0brbp9nVXbreBV7oYfmN/8BWFTH+c+E3roBb4/ankx+AD2Bk9R4PFqWitS9GTxvhD9wbWQX+8uybTzLTYdaoTW8XsLtOYnxlWrHbGp8N0K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pYF2wKge1JzXd7pKDbt9nYiLptGrvbpYa3PP5q+D8dxmSPse6rtwe/UaMqsn1sm5A9U0PoYvMYXfEAknMgs0UvALZIiAtSzMMab6rEOxN2h9br2cS4DruP7ebKD/vB5fEYvisLkNrY+/v0TqKvl5UlfHVlfs/4B/yNc3kDxArEbkWBuGxFIHmphT2IeAevnlv7vK4aM7t4I8Is2/7oS0lB5PWvGrrlwTaPmHHjD9Lp22y6rlUgy74XWK9YNsPtyeUuMWcQJJnKYpJ5wQ0W0MJS1NAPxEx+sqQDDvLWQWPZUNmaKmby X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea452106-f2b6-40ab-a08c-08dcb1655cbd X-MS-Exchange-CrossTenant-AuthSource: JH0PR06MB6849.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2024 13:33:28.6958 (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: VZQ0hbMmoHrTMOPGbmSTZOVFasdEXeXhH4qqqkuRKxZBg+9RaDM8NEdbgE45htRMmGggI/QP8E3WyjzWZ6iEgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB7334 X-Stat-Signature: c8wcytqcr5dqn7e9w4jitdoqtm7ii1bg X-Rspamd-Queue-Id: 5CB9B14002B X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1722432924-622032 X-HE-Meta: U2FsdGVkX18FxNK+a7Eh3oik3XuCKfCLR3m/hsM5cq3KiHfd6qir5E6Rqj4dRYg/QrCtgtKOdQ+v7qNdW/4IvcW52CaSQpBkTuGm5ikRndQR9Z2cGQXjmigbzD2eObyIVRC8nnPsgmMXdJsMmO6z3MwCOuSF+KfHtP4UHsS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eEqrEFkEfIbBUs34JBNBBJSSH8xU5HE1rUNJYt71WV8pppAJNqmsnEtW0PJhQagcBgc0XvFlC0F0hKl+ldwNHMYHKSJdF 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: List-Subscribe: List-Unsubscribe: Move task_is_dying() to include/linux/oom.h so that it can be referenced elsewhere. Signed-off-by: Zhiguo Jiang --- include/linux/oom.h | 6 ++++++ mm/memcontrol.c | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/oom.h b/include/linux/oom.h index 7d0c9c48a0c5..a3a58463c0d5 --- a/include/linux/oom.h +++ b/include/linux/oom.h @@ -77,6 +77,12 @@ static inline bool tsk_is_oom_victim(struct task_struct * tsk) return tsk->signal->oom_mm; } +static inline bool task_is_dying(void) +{ + return tsk_is_oom_victim(current) || fatal_signal_pending(current) || + (current->flags & PF_EXITING); +} + /* * Checks whether a page fault on the given mm is still reliable. * This is no longer true if the oom reaper started to reap the diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9b3ef3a70833..c54a8aea19b0 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -98,12 +98,6 @@ static DECLARE_WAIT_QUEUE_HEAD(memcg_cgwb_frn_waitq); #define THRESHOLDS_EVENTS_TARGET 128 #define SOFTLIMIT_EVENTS_TARGET 1024 -static inline bool task_is_dying(void) -{ - return tsk_is_oom_victim(current) || fatal_signal_pending(current) || - (current->flags & PF_EXITING); -} - /* Some nice accessors for the vmpressure. */ struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg) { From patchwork Wed Jul 31 13:33:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhiguojiang X-Patchwork-Id: 13748803 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 D0C56C3DA7F for ; Wed, 31 Jul 2024 13:33:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6352A6B0089; Wed, 31 Jul 2024 09:33:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BD896B008A; Wed, 31 Jul 2024 09:33:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C2556B008C; Wed, 31 Jul 2024 09:33:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 14B3A6B0089 for ; Wed, 31 Jul 2024 09:33:55 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AAB351C1777 for ; Wed, 31 Jul 2024 13:33:54 +0000 (UTC) X-FDA: 82400140788.27.B9F9283 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2056.outbound.protection.outlook.com [40.107.215.56]) by imf15.hostedemail.com (Postfix) with ESMTP id 76981A003B for ; Wed, 31 Jul 2024 13:33:51 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=N20k++xT; spf=pass (imf15.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.215.56 as permitted sender) smtp.mailfrom=justinjiang@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=1722432827; 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:in-reply-to:references:references:dkim-signature; bh=ObihyOKZQ/WIgIQoj2hpGxPMHAvrXspcNNpS+vgDLoE=; b=WbinwAwba/+QtFIWhNbdZNtCrOddQKo+lZbe+i/7SaxctuUPb8K9eMnuTDKSVAJBeiXV1r 0xwZg4cZTBSBnHbpPqddlY33RwWt96up0vU1avgEqTHvpTTpHfU/cIxGu5z0ivEfLDz7JX 8na+pwCMj7XmL/au01L040nsBqNE2Y4= ARC-Authentication-Results: i=2; imf15.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=N20k++xT; spf=pass (imf15.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.215.56 as permitted sender) smtp.mailfrom=justinjiang@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=1722432827; a=rsa-sha256; cv=pass; b=pRaalLeC5Dr6wtaO0uLEvvsD3MolMan4tcdnyqBHdcs6uYEbDJ8K26flxgJ3f20Gktd2O2 r2PbAr5U1lI8l0DSXg3SHG4MiNtLr9yGKbY0ZSYv7yTJUsZCqN1za8qsRP/sJYGvnrFsMa OJ+sUZkCW4XIJsdIVJNmjp4HDmB4WLg= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IBbfGChWJfoEiU108qZSB0MpTAbXX/mIL6mWEpcV8P/yDDdIPkog9CXqYMbu4fNppPSZU4KYk9n/qQ0+Npj20L+quBGlkBhYgyPIzXIow7ut+GQ8eGcMhL899H0Tq6zU2w7OdBYbkFyHH9To+oVm3wa4gFdOpBOn4wGEUw3hpf8yM020kGfl4eQMkb6sRP//yut+ocEbazSLGC2ihhKRYpaFdxjsEhmqe+jEq4OuU90bbrO638UijYm3+tUHx8WYl3wwxWwukqtRP8gnKIuVGU8vgVYU0D6rtBn8fwnpwT/xYmm9uOeOqkU1BBxahkuY2yVgMhewTiwnWHKG6yI1Bg== 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=ObihyOKZQ/WIgIQoj2hpGxPMHAvrXspcNNpS+vgDLoE=; b=Trave3MxE3fjUC702S9wrHfVzPH6cKFuArIps0uEmHl8eDrHTDKhTmwet0tnofQA1eo4DgW235d2pXTyb3mPogGOBJbjdHgJfKnBJF/GdIRqEf3uAfab/vM68Yp9XxCJy815RWm9IWMQMApZ3Qj7ldIpiTFkPCz0rZKZWyWvPyqJvgM4ZvaKe4cjCS9sQZLTrWooad0sZ2/k73F6AkMsMzYUXeO6/FuoOhdsdoYy3cOgPO+yqp7Ue2iKH1Ot3lHZzkE3MJRjjoBEriMhgV2DYqg3tEaoQzfZvYS94yALLyVvav5la+zR2HY07I4dzHsmQ+AEjvI40b9+Pk3g1prfQw== 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=ObihyOKZQ/WIgIQoj2hpGxPMHAvrXspcNNpS+vgDLoE=; b=N20k++xTQGf41fe6tvxUAFocppip0WoaAm3t/4BAvGkR+W2ggDCnYEeqfLc+ine2IrMIwS0dZTXMIntTDTZHVBsf7h8lp3tJjESrGt9/6XGDebBak2V/9i4swdwz0tWvd985uRN7Aj+ZIr6xai5hsdzaTWaQjKo9MFmYkUF74m7Dvx8nv4iugGZ855SSEFB4fxXErwhEsC+VkCmEVtrOpZH9XBZ6arm/CdB+ACy2b8ltX5digrkBCtsftHtouOCuDJhgJj/JetOvPDnTMxjPb1XF6QC7CtIewirMMUv9rGBFn8CCqnkccbZ6aqCGlE3Q25jIVqpQFcmUtDMguM8F5Q== Received: from JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) by TYZPR06MB7334.apcprd06.prod.outlook.com (2603:1096:405:a4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.27; Wed, 31 Jul 2024 13:33:30 +0000 Received: from JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::ed24:a6cd:d489:c5ed]) by JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::ed24:a6cd:d489:c5ed%3]) with mapi id 15.20.7828.016; Wed, 31 Jul 2024 13:33:30 +0000 From: Zhiguo Jiang To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Peter Zijlstra , Arnd Bergmann , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , linux-arch@vger.kernel.org, cgroups@vger.kernel.org, Barry Song <21cnbao@gmail.com>, kernel test robot , Zhiguo Jiang Cc: opensource.kernel@vivo.com Subject: [PATCH v2 2/3] mm: tlb: add tlb swap entries batch async release Date: Wed, 31 Jul 2024 21:33:16 +0800 Message-ID: <20240731133318.527-3-justinjiang@vivo.com> X-Mailer: git-send-email 2.41.0.windows.3 In-Reply-To: <20240731133318.527-1-justinjiang@vivo.com> References: <20240731133318.527-1-justinjiang@vivo.com> X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: JH0PR06MB6849:EE_|TYZPR06MB7334:EE_ X-MS-Office365-Filtering-Correlation-Id: bf23920c-4bdb-41ac-fc64-08dcb1655dc4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|52116014|366016|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: WcS2cwrN/SqJaTKjK4Jb64PW5HGI1ROvkjpIrFVPSRqptTu52eywdLoS+ujuAnvGfSCQf2+7G7sfT7NF7RN+7qdkq9m9qOc+uaDWuWoZanbECBW1Nc0bA/D8Q0Gw5SV7TAtqOR8TZU9a44KYEciC1Qlp9UMVPeOiMxiv0w83pKdi5T5bONjqWrad20qu5lBSNDQgasmcirXlYjpHMN2WLrafOzzi+y7DP2/E7Rj7R+G5+fR++9Xixqy1sDGYJBVFot08T1wiAoayy25i4ksUe5AeeVpqQpyaWAdu1Zm9Owp3d3yg9sBwJTdAHorcuUIowaAKbG1wRHnZPyBvS0aKgf6XXlNpAi0J6QLEafV95Ci9OtFD9rcYOEDqAb8sgf9hXl8B20r5ANwhGTrfUNbWKpJTqd1z4EBNPIdkAylhT7em10ZvGSOv1c+9uGYOieil1CISw+sEbHRWmIY6+1cwJ9UHX/oz6WpMgFuj57tmtLwY2l80Io3nbS2Y+fyduAuAjq8WoDs+hfkEMHRzycDoaNNQSzawWIZoOw1MGuRF0nbYBl6vOFrqfhgBJdRHGF/usi9Izv6GeZWpgt1JnpOMRt3qS1RZFrzDUUd7k3Zg9IWpNW9BL85vKXwNxMUGYpxyghVw9mLjmCKBHQzbGaeMDBi7CUTt8PSi9ek+Fo7RD811UldKEzQeAl/XdU2TW7RlFjfY33zu6Q2dMMWMQpWPMZFR037glVBRDNOBCac/4zG7m1OXbHBT395ml54mnwsdWdnw65zC8nhPFdi7ri6hVpZna3FctmCzSKOGXk8/UCsc4oVh0a23VDtoPTDzuPp8ypZImt8sgvYkrxZKRpAp6tXd1d1Gx7rjBraloEHmqr4SS2SxFrPxnLT5hmoc4GuTd0/v7ckXLAF0XVhYMxRzrDYnsqG5C12McSXkW04A5ShL114v/Whj4uuX8H38sJ/cmmCiFpf/Q3fDZ1t1FK3/+ZL1XzDl/NNIJSdKLmtEJXovBjYUzhUM2VVTOergWWR9hg1c1+zjI7YY3msNDkGdTBhuHdYKlR32QoeiCfxR9OLKl/dDEQY65yeX5S6OKMbRRzwndEHIcxp51OT9/vURf0yekL9hedYJQw5Dh4PQGIrntH3IcNamvcd8PMEkmOPEF2sRdrVZgSfLyqKLEdwxBsMf4SciPN6ECQDMAcpk+ZVvBBeQQ11ylcFyb7O7VHREt20p2IyTbt5ryni1ytPfOzNIj0oPvEfEoquMD9G/chb4F2JoQbRId3H5ZjyQo2dnPvgc/+LWqFeg7Z4+fDrgxCc/U4shNBAvidbrL9szN1Htfq+H66Ut2wAmX0mb4JbZm09B+Kb73SHSnXGgYkNoxPxcEsLNnu5VGO1HEqi1XIX9GIw5xZoeiCklUngqitw8z+PXnfW3kye3s6zeQ1v+IXn0/ru4H22XWSwokLCcxdk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:JH0PR06MB6849.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(52116014)(366016)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2jYb25M6hDgjt+dphtwRh3WQ34xnFFQ20GFVoAUIyaDAJ+urjaSv73STOni0+3ufOUAjklFxZM2G6g1J3rhng5thjhlHAPdYyE9jjaTJhF/8uXUe9llnx65CYw+jWEpk5xc6pB2mlR/6k0Y/PYyBqwCTcYR8Lt1keDGd/rqPZoZ64JgWY0GT7JBJnySb+vKCgr0loADOV0z34ffwbZXGbLnIAocGzt/pUENFRzIWFld4ClHWSfcThhJoTMfXRG3WtCNZoPSmbomHn1/WNwEHSCH0Suf2mvrRiIxt1zZsyjOtdrVUDs2VzUWLrQK05sOL9+1DcW1M8afteRol5t3rObKQLraQZzDfKVfhvQiM73bCCOxn4cvQvCl75m44EaFhJhC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r+3FXm1Np1enzxF/Uhzjx3bp+AlxZTOuK4w7zTAwsBFDbYEkTiorkxOo/WCLGs9j2d4NFcN3HuYUbrRCM4uwHijIOTChcnhJMRr8y4A8x/Q+mueTEd5zFK7nv6VekTIq9ItDpdS9/ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf23920c-4bdb-41ac-fc64-08dcb1655dc4 X-MS-Exchange-CrossTenant-AuthSource: JH0PR06MB6849.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2024 13:33:30.4061 (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: qD4gS2vb2uDXKPlbmJYwYeTnsfa4sExi4kPoErPBHaSNx7lIKeiCpanMQfSMXnqXnPYYD8Rolb5m9lErKT+YAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB7334 X-Rspam-User: X-Stat-Signature: ne7syhtp9z1s4ydwt1xkcrkn97fqedm5 X-Rspamd-Queue-Id: 76981A003B X-Rspamd-Server: rspam11 X-HE-Tag: 1722432831-82120 X-HE-Meta: U2FsdGVkX1+uFxa1N0GxXeyMZTLG04eUuAZCSBRHm8MhFqNgrgxa8gWIA3ljdXEPFs66Smj1vT7jHH618BON6XIDBZZxRxzs/MOWHOoVY5X9Tfj2f7sLxO+1jtgqF0QzNW9fM7T28hSO6mYfq7i6zygZ4ukgyyHyukLrLBrovBd1Ink7YHV4C+XGE0fKOq9RRF5h5rXdTWUVJfLKpxAUZn1b1e38EpthbnA4ptmxcWhM3aaDA/V+mXdt/nr9dyexBRVgh7UEfIsGhQ5Vd9ECuPtJbjEcrMEGBwusvVQdosI/13UAC1GVOBSQ9ynTZRlN24Wht0XsLQn+qT0ZcHK8lTuVjJIheJYYvYbveA6IfPkIcCXP8SoFucNsGUyKCP5nYz7MnRsCljIoQ2wAGbb5Uire4BgYI6ZaslvjpVTYWw1RAqetYE6d4klRQnqRvuMeXiXPK83bd904/fAd2OcR3IP8N/8Ir0czntugI3mm5Ob+RM9x9NjkWlmWgO6IGz3pHII/OVS26AJUNMQD5p5AsL4XE0VMGJwr31z8pTR/PhU0pFVk3atN8IJcZfA6QKnvmG7+vCztFeYQT2Iu68esMCG3OhDHfK73BrpB8bVOEYwwcm10Oi9wJMjWx+uAaVimtvpEN0Y1nc2ZAeDC1uGooLssU++24tNFoBznYitlZ27JHHbnxRuBeLNP97JK1K09+41AbM+2ZJgMeyptb1J4QT1O2dH9CdtkFJdjgiD6JqQ1dWzkjZKoQu1XV8Hn/dThJva7/LWHI9sISCFE/3wwgc3pLXJImL46QLyeiW4hksfMhzzixvXJEKY5W2cEOJEhvhRYf70rCNsM8zcXZjQWpaR0iyX2KIGdheuaoA/Prk4LeimE5CJdHeRZwoGrneveKiS8FJvbJ/YC8N/Hrzcl+6XAZxbO2KLo7e1s1FKaqmjNKy+WKDzHsBAiP/iC/3vAXHbCRimL4pHTU5b+Y+V CebZkWgO MT/q4JWREIaboKD8fZLLxKGY87HztipgQfnIQVpYZhFYlbgjn78vsqMQdIf3pEk6aKvNGAVCqqpstqusVblu+QqH1xZe0MuhO3rOYxEw60wbDq/vg+vBtUsYHJBhfUxef2YiEFgrFzVIMcVwNRQzIB0CNjzSB67qo7iAVT3UxJfVJfGcT46E8SRWF9cu/Jg/6Hp44OTRRUcr7ZwK6ky8HiEhE1fNdbtBveQ68uaExYICKjeyiMvX6ivVKrHKGd04nEBfR 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: List-Subscribe: List-Unsubscribe: The main reasons for the prolonged exit of a background process is the time-consuming release of its swap entries. The proportion of swap memory occupied by the background process increases with its duration in the background, and after a period of time, this value can reach 60% or more. Additionally, the relatively lengthy path for releasing swap entries further contributes to the longer time required for the background process to release its swap entries. In the multiple background applications scenario, when launching a large memory application such as a camera, system may enter a low memory state, which will triggers the killing of multiple background processes at the same time. Due to multiple exiting processes occupying multiple CPUs for concurrent execution, the current foreground application's CPU resources are tight and may cause issues such as lagging. To solve this problem, we have introduced the multiple exiting process asynchronous swap memory release mechanism, which isolates and caches swap entries occupied by multiple exit processes, and hands them over to an asynchronous kworker to complete the release. This allows the exiting processes to complete quickly and release CPU resources. We have validated this modification on the products and achieved the expected benefits. It offers several benefits: 1. Alleviate the high system cpu load caused by multiple exiting processes running simultaneously. 2. Reduce lock competition in swap entry free path by an asynchronous kworker instead of multiple exiting processes parallel execution. 3. Release memory occupied by exiting processes more efficiently. Signed-off-by: Zhiguo Jiang --- include/asm-generic/tlb.h | 44 ++++++ include/linux/mm_types.h | 58 ++++++++ mm/memory.c | 3 +- mm/mmu_gather.c | 297 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 401 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 709830274b75..8b4d516b35b8 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -294,6 +294,37 @@ extern void tlb_flush_rmaps(struct mmu_gather *tlb, struct vm_area_struct *vma); static inline void tlb_flush_rmaps(struct mmu_gather *tlb, struct vm_area_struct *vma) { } #endif +#ifndef CONFIG_MMU_GATHER_NO_GATHER +struct mmu_swap_batch { + struct mmu_swap_batch *next; + unsigned int nr; + unsigned int max; + encoded_swpentry_t encoded_entrys[]; +}; + +#define MAX_SWAP_GATHER_BATCH \ + ((PAGE_SIZE - sizeof(struct mmu_swap_batch)) / sizeof(void *)) + +#define MAX_SWAP_GATHER_BATCH_COUNT (10000UL / MAX_SWAP_GATHER_BATCH) + +struct mmu_swap_gather { + /* + * the asynchronous kworker to batch + * release swap entries + */ + struct work_struct free_work; + + /* batch cache swap entries */ + unsigned int batch_count; + struct mmu_swap_batch *active; + struct mmu_swap_batch local; + encoded_swpentry_t __encoded_entrys[MMU_GATHER_BUNDLE]; +}; + +bool __tlb_remove_swap_entries(struct mmu_gather *tlb, + swp_entry_t entry, int nr); +#endif + /* * struct mmu_gather is an opaque type used by the mm code for passing around * any data needed by arch specific code for tlb_remove_page. @@ -343,6 +374,18 @@ struct mmu_gather { unsigned int vma_exec : 1; unsigned int vma_huge : 1; unsigned int vma_pfn : 1; +#ifndef CONFIG_MMU_GATHER_NO_GATHER + /* + * Two states of releasing swap entries + * asynchronously: + * swp_freeable - have opportunity to + * release asynchronously future + * swp_freeing - be releasing asynchronously. + */ + unsigned int swp_freeable : 1; + unsigned int swp_freeing : 1; + unsigned int swp_disable : 1; +#endif unsigned int batch_count; @@ -354,6 +397,7 @@ struct mmu_gather { #ifdef CONFIG_MMU_GATHER_PAGE_SIZE unsigned int page_size; #endif + struct mmu_swap_gather *swp; #endif }; diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 485424979254..f26fbff93ff4 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -283,6 +283,64 @@ typedef struct { unsigned long val; } swp_entry_t; +/* + * encoded_swpentry_t - a type marking the encoded swp_entry_t. + * + * An 'encoded_swpentry_t' represents a 'swp_enrty_t' with its the highest + * bit indicating extra context-dependent information. Only used in swp_entry + * asynchronous release path by mmu_swap_gather. + */ +typedef struct { + unsigned long val; +} encoded_swpentry_t; + +/* + * The next item in an encoded_swpentry_t array is the "nr" argument, specifying the + * total number of consecutive swap entries associated with the same folio. If this + * bit is not set, "nr" is implicitly 1. + * + * Refer to include\asm\pgtable.h, swp_offset bits: 0 ~ 57, swp_type bits: 58 ~ 62. + * Bit63 can be used here. + */ +#define ENCODED_SWPENTRY_BIT_NR_ENTRYS_NEXT (1UL << (BITS_PER_LONG - 1)) + +static __always_inline encoded_swpentry_t +encode_swpentry(swp_entry_t entry, unsigned long flags) +{ + encoded_swpentry_t ret; + + VM_WARN_ON_ONCE(flags & ~ENCODED_SWPENTRY_BIT_NR_ENTRYS_NEXT); + ret.val = flags | entry.val; + return ret; +} + +static inline unsigned long encoded_swpentry_flags(encoded_swpentry_t entry) +{ + return ENCODED_SWPENTRY_BIT_NR_ENTRYS_NEXT & entry.val; +} + +static inline swp_entry_t encoded_swpentry_data(encoded_swpentry_t entry) +{ + swp_entry_t ret; + + ret.val = ~ENCODED_SWPENTRY_BIT_NR_ENTRYS_NEXT & entry.val; + return ret; +} + +static __always_inline encoded_swpentry_t encode_nr_swpentrys(unsigned long nr) +{ + encoded_swpentry_t ret; + + VM_WARN_ON_ONCE(nr & ENCODED_SWPENTRY_BIT_NR_ENTRYS_NEXT); + ret.val = nr; + return ret; +} + +static __always_inline unsigned long encoded_nr_swpentrys(encoded_swpentry_t entry) +{ + return ((~ENCODED_SWPENTRY_BIT_NR_ENTRYS_NEXT) & entry.val); +} + /** * struct folio - Represents a contiguous set of bytes. * @flags: Identical to the page flags. diff --git a/mm/memory.c b/mm/memory.c index b9f5cc0db3eb..bfa1995558d2 --- a/mm/memory.c +++ b/mm/memory.c @@ -1650,7 +1650,8 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, if (!should_zap_cows(details)) continue; rss[MM_SWAPENTS] -= nr; - free_swap_and_cache_nr(entry, nr); + if (!__tlb_remove_swap_entries(tlb, entry, nr)) + free_swap_and_cache_nr(entry, nr); } else if (is_migration_entry(entry)) { folio = pfn_swap_entry_folio(entry); if (!should_zap_folio(details, folio)) diff --git a/mm/mmu_gather.c b/mm/mmu_gather.c index 99b3e9408aa0..2bb413d052bd --- a/mm/mmu_gather.c +++ b/mm/mmu_gather.c @@ -9,11 +9,304 @@ #include #include #include +#include #include #include #ifndef CONFIG_MMU_GATHER_NO_GATHER +/* + * The swp_entry asynchronous release mechanism for multiple processes exiting + * simultaneously. + * + * During the multiple exiting processes releasing their own mm simultaneously, + * the swap entries in the exiting processes are handled by isolating, caching + * and handing over to an asynchronous kworker to complete the release. + * + * The conditions for the exiting process entering the swp_entry asynchronous + * release path: + * 1. The exiting process's MM_SWAPENTS count is >= SWAP_CLUSTER_MAX, avoiding + * to alloc struct mmu_swap_gather frequently. + * 2. The number of exiting processes is >= NR_MIN_EXITING_PROCESSES. + * + * Since the time for determining the number of exiting processes is dynamic, + * the exiting process may start to enter the swp_entry asynchronous release + * at the beginning or middle stage of the exiting process's swp_entry release + * path. + * + * Once an exiting process enters the swp_entry asynchronous release, all remaining + * swap entries in this exiting process need to be fully released by asynchronous + * kworker theoretically. + * + * The function of the swp_entry asynchronous release: + * 1. Alleviate the high system cpu load caused by multiple exiting processes + * running simultaneously. + * 2. Reduce lock competition in swap entry free path by an asynchronous kworker + * instead of multiple exiting processes parallel execution. + * 3. Release memory occupied by exiting processes more efficiently. + */ + +/* + * The min number of exiting processes required for swp_entry asynchronous release + */ +#define NR_MIN_EXITING_PROCESSES 2 + +atomic_t nr_exiting_processes = ATOMIC_INIT(0); +static struct kmem_cache *swap_gather_cachep; +static struct workqueue_struct *swapfree_wq; +static DEFINE_STATIC_KEY_TRUE(tlb_swap_asyncfree_disabled); + +static int __init tlb_swap_async_free_setup(void) +{ + swapfree_wq = alloc_workqueue("smfree_wq", WQ_UNBOUND | + WQ_HIGHPRI | WQ_MEM_RECLAIM, 1); + if (!swapfree_wq) + goto fail; + + swap_gather_cachep = kmem_cache_create("swap_gather", + sizeof(struct mmu_swap_gather), + 0, SLAB_TYPESAFE_BY_RCU | SLAB_PANIC | SLAB_ACCOUNT, + NULL); + if (!swap_gather_cachep) + goto kcache_fail; + + static_branch_disable(&tlb_swap_asyncfree_disabled); + return 0; + +kcache_fail: + destroy_workqueue(swapfree_wq); +fail: + return -ENOMEM; +} +postcore_initcall(tlb_swap_async_free_setup); + +static void __tlb_swap_gather_free(struct mmu_swap_gather *swap_gather) +{ + struct mmu_swap_batch *swap_batch, *next; + + for (swap_batch = swap_gather->local.next; swap_batch; swap_batch = next) { + next = swap_batch->next; + free_page((unsigned long)swap_batch); + } + swap_gather->local.next = NULL; + kmem_cache_free(swap_gather_cachep, swap_gather); +} + +static void tlb_swap_async_free_work(struct work_struct *w) +{ + int i, nr_multi, nr_free; + swp_entry_t start_entry; + struct mmu_swap_batch *swap_batch; + struct mmu_swap_gather *swap_gather = container_of(w, + struct mmu_swap_gather, free_work); + + /* Release swap entries cached in mmu_swap_batch. */ + for (swap_batch = &swap_gather->local; swap_batch && swap_batch->nr; + swap_batch = swap_batch->next) { + nr_free = 0; + for (i = 0; i < swap_batch->nr; i++) { + if (unlikely(encoded_swpentry_flags(swap_batch->encoded_entrys[i]) & + ENCODED_SWPENTRY_BIT_NR_ENTRYS_NEXT)) { + start_entry = encoded_swpentry_data(swap_batch->encoded_entrys[i]); + nr_multi = encoded_nr_swpentrys(swap_batch->encoded_entrys[++i]); + free_swap_and_cache_nr(start_entry, nr_multi); + nr_free += 2; + } else { + start_entry = encoded_swpentry_data(swap_batch->encoded_entrys[i]); + free_swap_and_cache_nr(start_entry, 1); + nr_free++; + } + } + swap_batch->nr -= nr_free; + WARN_ON_ONCE(swap_batch->nr); + } + __tlb_swap_gather_free(swap_gather); +} + +static bool __tlb_swap_gather_mmu_check(struct mmu_gather *tlb) +{ + /* + * Only the exiting processes with the MM_SWAPENTS counter >= + * SWAP_CLUSTER_MAX have the opportunity to release their swap + * entries by asynchronous kworker. + */ + if (!task_is_dying() || + get_mm_counter(tlb->mm, MM_SWAPENTS) < SWAP_CLUSTER_MAX) + return true; + + atomic_inc(&nr_exiting_processes); + if (atomic_read(&nr_exiting_processes) < NR_MIN_EXITING_PROCESSES) + tlb->swp_freeable = 1; + else + tlb->swp_freeing = 1; + + return false; +} + +/** + * __tlb_swap_gather_init - Initialize an mmu_swap_gather structure + * for swp_entry tear-down. + * @tlb: the mmu_swap_gather structure belongs to tlb + */ +static bool __tlb_swap_gather_init(struct mmu_gather *tlb) +{ + tlb->swp = kmem_cache_alloc(swap_gather_cachep, GFP_ATOMIC | GFP_NOWAIT); + if (unlikely(!tlb->swp)) + return false; + + tlb->swp->local.next = NULL; + tlb->swp->local.nr = 0; + tlb->swp->local.max = ARRAY_SIZE(tlb->swp->__encoded_entrys); + + tlb->swp->active = &tlb->swp->local; + tlb->swp->batch_count = 0; + + INIT_WORK(&tlb->swp->free_work, tlb_swap_async_free_work); + return true; +} + +static void __tlb_swap_gather_mmu(struct mmu_gather *tlb) +{ + if (static_branch_unlikely(&tlb_swap_asyncfree_disabled)) + return; + + tlb->swp = NULL; + tlb->swp_freeable = 0; + tlb->swp_freeing = 0; + tlb->swp_disable = 0; + + if (__tlb_swap_gather_mmu_check(tlb)) + return; + + /* + * If the exiting process meets the conditions of + * swp_entry asynchronous release, an mmu_swap_gather + * structure will be initialized. + */ + if (tlb->swp_freeing) + __tlb_swap_gather_init(tlb); +} + +static void __tlb_swap_gather_queuework(struct mmu_gather *tlb, bool finish) +{ + queue_work(swapfree_wq, &tlb->swp->free_work); + tlb->swp = NULL; + if (!finish) + __tlb_swap_gather_init(tlb); +} + +static bool __tlb_swap_next_batch(struct mmu_gather *tlb) +{ + struct mmu_swap_batch *swap_batch; + + if (tlb->swp->batch_count == MAX_SWAP_GATHER_BATCH_COUNT) + goto free; + + swap_batch = (void *)__get_free_page(GFP_ATOMIC | GFP_NOWAIT); + if (unlikely(!swap_batch)) + goto free; + + swap_batch->next = NULL; + swap_batch->nr = 0; + swap_batch->max = MAX_SWAP_GATHER_BATCH; + + tlb->swp->active->next = swap_batch; + tlb->swp->active = swap_batch; + tlb->swp->batch_count++; + return true; +free: + /* batch move to wq */ + __tlb_swap_gather_queuework(tlb, false); + return false; +} + +/** + * __tlb_remove_swap_entries - the swap entries in exiting process are + * isolated, batch cached in struct mmu_swap_batch. + * @tlb: the current mmu_gather + * @entry: swp_entry to be isolated and cached + * @nr: the number of consecutive entries starting from entry parameter. + */ +bool __tlb_remove_swap_entries(struct mmu_gather *tlb, + swp_entry_t entry, int nr) +{ + struct mmu_swap_batch *swap_batch; + unsigned long flags = 0; + bool ret = false; + + if (tlb->swp_disable) + return ret; + + if (!tlb->swp_freeable && !tlb->swp_freeing) + return ret; + + + if (tlb->swp_freeable) { + if (atomic_read(&nr_exiting_processes) < + NR_MIN_EXITING_PROCESSES) + return ret; + /* + * If the current number of exiting processes + * is >= NR_MIN_EXITING_PROCESSES, the exiting + * process with swp_freeable state will enter + * swp_freeing state to start releasing its + * remaining swap entries by the asynchronous + * kworker. + */ + tlb->swp_freeable = 0; + tlb->swp_freeing = 1; + } + + VM_BUG_ON(tlb->swp_freeable || !tlb->swp_freeing); + if (!tlb->swp && !__tlb_swap_gather_init(tlb)) + return ret; + + swap_batch = tlb->swp->active; + if (unlikely(swap_batch->nr >= swap_batch->max - 1)) { + __tlb_swap_gather_queuework(tlb, false); + return ret; + } + + if (likely(nr == 1)) { + swap_batch->encoded_entrys[swap_batch->nr++] = encode_swpentry(entry, flags); + } else { + flags |= ENCODED_SWPENTRY_BIT_NR_ENTRYS_NEXT; + swap_batch->encoded_entrys[swap_batch->nr++] = encode_swpentry(entry, flags); + swap_batch->encoded_entrys[swap_batch->nr++] = encode_nr_swpentrys(nr); + } + ret = true; + + if (swap_batch->nr >= swap_batch->max - 1) { + if (!__tlb_swap_next_batch(tlb)) + goto exit; + swap_batch = tlb->swp->active; + } + VM_BUG_ON(swap_batch->nr > swap_batch->max - 1); +exit: + return ret; +} + +static void __tlb_batch_swap_finish(struct mmu_gather *tlb) +{ + if (tlb->swp_disable) + return; + + if (!tlb->swp_freeable && !tlb->swp_freeing) + return; + + if (tlb->swp_freeable) { + tlb->swp_freeable = 0; + VM_BUG_ON(tlb->swp_freeing); + goto exit; + } + tlb->swp_freeing = 0; + if (unlikely(!tlb->swp)) + goto exit; + + __tlb_swap_gather_queuework(tlb, true); +exit: + atomic_dec(&nr_exiting_processes); +} static bool tlb_next_batch(struct mmu_gather *tlb) { @@ -386,6 +679,9 @@ static void __tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, tlb->local.max = ARRAY_SIZE(tlb->__pages); tlb->active = &tlb->local; tlb->batch_count = 0; + + tlb->swp_disable = 1; + __tlb_swap_gather_mmu(tlb); #endif tlb->delayed_rmap = 0; @@ -466,6 +762,7 @@ void tlb_finish_mmu(struct mmu_gather *tlb) #ifndef CONFIG_MMU_GATHER_NO_GATHER tlb_batch_list_free(tlb); + __tlb_batch_swap_finish(tlb); #endif dec_tlb_flush_pending(tlb->mm); } From patchwork Wed Jul 31 13:33:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhiguojiang X-Patchwork-Id: 13748804 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 380C0C3DA64 for ; Wed, 31 Jul 2024 13:35:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C9EBB6B008C; Wed, 31 Jul 2024 09:35:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C27A16B0092; Wed, 31 Jul 2024 09:35:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A53446B0093; Wed, 31 Jul 2024 09:35:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8159D6B008C for ; Wed, 31 Jul 2024 09:35:12 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 42859C036D for ; Wed, 31 Jul 2024 13:35:12 +0000 (UTC) X-FDA: 82400144064.10.197F426 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2066.outbound.protection.outlook.com [40.107.215.66]) by imf07.hostedemail.com (Postfix) with ESMTP id 36DE440018 for ; Wed, 31 Jul 2024 13:35:08 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=qcsdm8tQ; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf07.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.215.66 as permitted sender) smtp.mailfrom=justinjiang@vivo.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1722432868; a=rsa-sha256; cv=pass; b=y9X+pTdKj4uzhM+2LARB6YEu2+bLsgAKcVH8KWdLt6jXDG9rLlWifRf8W+toduzsgQ+Lm+ k9KByFT92bySFreRAoi5hCE4NJqkyQc5QvjqyIjNvltfsdDZvLsoxG5dCTQP4WMNslBf8W qYxnSOY52x6aPVW4m1RYrZnCWA+LD1A= ARC-Authentication-Results: i=2; imf07.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=qcsdm8tQ; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf07.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.215.66 as permitted sender) smtp.mailfrom=justinjiang@vivo.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722432868; 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:in-reply-to:references:references:dkim-signature; bh=/QhpATYNabFfEKScK8u3kghz7HpalaoLiHjaRKPLXJY=; b=YTf6iiUNogW9YVL7O6j+Dlfbb2su8xOAUPMsh+ZdDi2w0qAUC2QMLR4wcCxy/D90TAKK/l Di8J4Z+nnpDNCV9eH6vedAF8mtpRA/1YR8cbEZnqrR9DXzIBvY5Rmv7zEZjrxvdKcFnvYg avLHH7xNplwy+nyxlLi0EQehzxBX5GU= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q9aUvEIOnAY2YBqICCvRD6ldR99K0cZRjXbg2k/eP026xtNL4r59cu3iVQNYTCCW//iiENTCm6IZR2z+P5BOu/zw682hvdtyJMGE+xzhlpajUAtAkD/bfNTKhRO13XvoerH+bN72qZr+Dn6DeKeYSTcBuZV0DM1sup06y9H7Yzpdso3syFTZnxTPSnLwv9NTx1R7KVZFwVLWqdcMvFCYkEidPTJJozA0V4D5Qxdr/Rf6+4o8HefCOb2x7rVFYDGyNCZK3NfTE51MudPkgGpUyPkoKkyfe49uO/MpjeAwkGLqx8o4Ngupu5lwLtZ5cKRlkvb1PNhNGjckRSCjDbYYvg== 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=/QhpATYNabFfEKScK8u3kghz7HpalaoLiHjaRKPLXJY=; b=cXe0EKPbtH+Vcfh54VnBAFF3zmnAM970f++dBuC6y91eN4GblEWdue/pC0vMeB6JS1A1Wau0j264oPPvpxseAgDnFc1ASBrC0WDObu4d9Iafn/WvBlKePNiBWPnO4MA8I8Q3HAc7z6mT+Sm4YSPhJIlJZ81cetI2wNR5B0wZafDSuqD0UyMULDiGoqP+SONhXgX1Hpk6rD8v+y8RyRK1WwicbSZI+0tKWpsRlCs/IzNoqo+zqeHSw+wcHekqpSxiN7YOs1BPM7oJlsMw8aL57txV+ckGHDVU2CEdvsOCVt7E2/NSEVXq36RU1mtkQtI+C3T4DUQuCr3nQhHXKEQpzQ== 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=/QhpATYNabFfEKScK8u3kghz7HpalaoLiHjaRKPLXJY=; b=qcsdm8tQjSqjvuimqVG1a6ww6jPQxl2b6qkvtpG6kzFmO4xU/QHzXJt2AEVezHkj5AbbYvNA+0+seAnkuXPM884mk3iBdlH/BphWbzxqZeETYxYoq+wP5KUY2ehcyIB+n4YnEUEUjuUQK3G2qv6FmIfBmLleWFNLiYa2JkAcRHgAbSObWkS1aS2c8ZyyIn3Px/V+BvECsAyYAXkcBn9v3L5mRuOVmFEcm0ilE75wtXrCNIdhYATl9W7fHVMPdIlBGl55aF3PNhg9A77KyORqKuXCIPklpqkPl7XdBmiI4gpH0blifBcS5iRHgf3Mr7roJOA3/dGp79HkzJeG9elqcA== Received: from JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) by TYZPR06MB7334.apcprd06.prod.outlook.com (2603:1096:405:a4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.27; Wed, 31 Jul 2024 13:33:32 +0000 Received: from JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::ed24:a6cd:d489:c5ed]) by JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::ed24:a6cd:d489:c5ed%3]) with mapi id 15.20.7828.016; Wed, 31 Jul 2024 13:33:32 +0000 From: Zhiguo Jiang To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Peter Zijlstra , Arnd Bergmann , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , linux-arch@vger.kernel.org, cgroups@vger.kernel.org, Barry Song <21cnbao@gmail.com>, kernel test robot , Zhiguo Jiang Cc: opensource.kernel@vivo.com Subject: [PATCH v2 3/3] mm: s390: fix compilation warning Date: Wed, 31 Jul 2024 21:33:17 +0800 Message-ID: <20240731133318.527-4-justinjiang@vivo.com> X-Mailer: git-send-email 2.41.0.windows.3 In-Reply-To: <20240731133318.527-1-justinjiang@vivo.com> References: <20240731133318.527-1-justinjiang@vivo.com> X-ClientProxiedBy: SI2PR02CA0019.apcprd02.prod.outlook.com (2603:1096:4:195::13) To JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: JH0PR06MB6849:EE_|TYZPR06MB7334:EE_ X-MS-Office365-Filtering-Correlation-Id: 0bf83302-f817-4095-26a7-08dcb1655ecc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|52116014|366016|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: 6Js3QYn0bUJ9K6TUrONW7Y+h7FGJubTjp0jkB9by/Ru9pohi1e4jIul7Fo7X9SnxuXaNYxlwL8kG6VB20fM3+TtUf1bDu6DUZTYSY/Gj0rsk7R/3fkjzh5yLokqZ9wJFggqXlUeGcEbJyn88/lYxs17zcaK9+jzZPtzpgWS5FYa6VUy5g+XfRBU4lPcSM+7Ima1bAY2PPodzYqJg3lIVM3jrp9Rcwh3qT6bPdrYTFap6zpc8/io7cxHK8SmNuqHuJ78+kFbcoUVbTrFazg4Uk2G7mqIOe+k8C42yb6qsLzG3UBug7rsJrybQJ3i0jKLCMXwuB12EJyhGEFTFi9z1ur9ni3EFLE0tv+NiX6rljHRz6jM4b6hddtleFWv8PXdHXEIR3wszFWRTGBwr+sGKX8nJ2PF6PMK+Xt6FOcM4LbTsz5yS588K7tO0ouIM/tqpIpoXOiWQy/yZMOrB4frg+MJrG0ophFhCvZQOU82/ngAFET81Bvozjs9XjZDOEFOaHeKIYsDcMsN+xDfXUopxWJUTW0fyCIzW8xm21BXGAH1qWR/NRs3426vbYlESCDqlLAej1VmutmZRg8eyoFA1vuu+sn/uMrAPjBYpIagRtp0bgnOpvyoJoY1/wh5bCiB+ZEf4CjQ6SB3aq9ZXnXW6k19PSfGkVCnyXv+wbC6Ga8eW4moeANKtTvLZgah+gbcSjp1L7GatzCntBroK8SUbvnU2WDoviBiPECdnR3h9cNg0meRTJK+pHc/+JuvG0COy7SPGEK7jr+ORisFNy0wSKHisTWta8alztVVlYF6iH9AbyFqTe3O/G91+M5IN+VKes1lB++k9dw/Gcq+6UWDIVNI2zmkcItUu1zHnYllzqV357bt9Cs7K65Xe6MBFGkMCgP2w0s1R+KPgqy+alf/g7z5PagJPrNUW37dHmT1xndO8+hfD7lXxbGXhDL8sF4S94prMb1dS+DBDMSDvZQVt4ABNaoJJkCdqloy/uQyO3lmtIE0ZBoD8iWGHvl10uW1aCtYNmwUITuBTTHTdsY2v/49mZtitOcGhSQNVINnyiurJB4pLzDZxp5hH2NT6gagSlybUBroZxJ9Dk9LBSLDZP9Tqb6OFsFfbuwzgm0vzclFbYvYzUb9+U2WhTmCPpT79w4aXBaIhZE4kQ8dTXvqeCXjluRHw6+sCaGWSS/55TYG0rBILQdvm+VVBWUIdxe9yNB0Vv6CqWds/D0Ct55Znd3vmE43oGxOqPDOqieL+1o8NE+PIEn52C145lIeNtcNqrBCXUgiSqc4J78JlWug+DB5XaZvwzW2TJNwI1Va5bVaXwYANceZHI7Z/ULrS7p11juzfDA20UO2cM/P8IllH2Zf3DSCC0imXL93fBWlg77UUojwzSNYvlxp4M/ZiM9dt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:JH0PR06MB6849.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(52116014)(366016)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TCvxXeSuTOtG8AG0kGPUfO6btzM58bpB4T6s/HgJuMGjzJrHhJiVgB+/8Ee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cETmwB8hLl6dlc3P9rn71wilqHxg3b1f25SFm0cU7tCcfzHIN3BWFhByiywLv1c3lok1GJspE9Bw4Vjs9X/ni8GkuENQaTl5pdN6JYKXd32KnVyn2nHatbhFNt0KYUxROsZDZg3kJuSitVNdTV4uqzTBBFXbp6tJYBVQcev1H19jx3OqruOEyUQc4pRpA8V/pb5mvDzPlfEfCV52E7RS9D5+sFxM4CZrhGcOvIeS231e0LricutdDOLYYp62920/8F2ePSPDMfBzeuLrhUiWmffZroOz5DEq2W64e/UwfmNG1he/METPMq89QjxABntpVEetBn39GPw4jFCA7OeMnLsvf3D+pPPUvmWxmB/vIiG6gIzGBCP0AM5l5+j+NWhY6DbPrYmecrPgmFuSHVg2RswwLFD6kCU7YEhfze6eBBccfHHznM5qpuwE6BwYfK9ETP X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bf83302-f817-4095-26a7-08dcb1655ecc X-MS-Exchange-CrossTenant-AuthSource: JH0PR06MB6849.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2024 13:33:32.1319 (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: zW3eL3xKwLuQTnTqwr87pLqbErpYxX+y+LcusrGjx45H1/WLb653Fd7N8pmxG1KIKXfMyiMn6JW90hji2+Q/SQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB7334 X-Rspamd-Queue-Id: 36DE440018 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 1k5ss4y1kisw4awxnqdmaw7r8h13tt6m X-HE-Tag: 1722432908-310084 X-HE-Meta: U2FsdGVkX18qA+71iJqdw3YDN/D4ixH4DX5bTVNxyM5ltTrVQj0gcQO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C2mf2PBTapVEsKj0oZyRzrjJjna6fNfnGrvePSxB8vYuOh88+Bz7bswRUf93qkewYiUoo/ONQYv4S90FlQn1XF4TGPgeaVMFCxgLlLBw2qRQPDmFHPRuPLGTBEUAx6Rq8LZ5yBoHA9OH3cChY1nQrEzJK+wZFkmkHyijcs/c2N6C03N1MJAOjYVqPJhN/kwDgt80ex0g3BoLh3NsA== 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: List-Subscribe: List-Unsubscribe: Define static inline bool __tlb_remove_page_size() to fix arch s390 config compilation Warning. Signed-off-by: Zhiguo Jiang --- Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202407311703.8q8sDQ2p-lkp@intel.com/ Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202407311947.VPJNRqad-lkp@intel.com/ arch/s390/include/asm/tlb.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index e95b2c8081eb..3f681f63390f --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h @@ -28,6 +28,8 @@ static inline bool __tlb_remove_page_size(struct mmu_gather *tlb, struct page *page, bool delay_rmap, int page_size); static inline bool __tlb_remove_folio_pages(struct mmu_gather *tlb, struct page *page, unsigned int nr_pages, bool delay_rmap); +static inline bool __tlb_remove_swap_entries(struct mmu_gather *tlb, + swp_entry_t entry, int nr); #define tlb_flush tlb_flush #define pte_free_tlb pte_free_tlb @@ -69,6 +71,12 @@ static inline bool __tlb_remove_folio_pages(struct mmu_gather *tlb, return false; } +static inline bool __tlb_remove_swap_entries(struct mmu_gather *tlb, + swp_entry_t entry, int nr) +{ + return false; +} + static inline void tlb_flush(struct mmu_gather *tlb) { __tlb_flush_mm_lazy(tlb->mm);