Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1476658rdb; Wed, 24 Jan 2024 17:35:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlo9hszUbRAP6t6YSRkFpy6QIcKKh6R0Dpc1w4RtUOdyLiNo7jZS22igTT1Fy5doi8G/V1 X-Received: by 2002:a17:907:376:b0:a30:f60f:9df1 with SMTP id rs22-20020a170907037600b00a30f60f9df1mr67693ejb.139.1706146510337; Wed, 24 Jan 2024 17:35:10 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y23-20020a170906071700b00a2ee3b9708asi444788ejb.45.2024.01.24.17.35.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 17:35:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=jEmoUSgX; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-37854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37854-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1D7F31F22C19 for ; Thu, 25 Jan 2024 01:35:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D699717CE; Thu, 25 Jan 2024 01:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="jEmoUSgX" Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2092.outbound.protection.outlook.com [40.107.255.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AC05EA9 for ; Thu, 25 Jan 2024 01:35:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.92 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706146502; cv=fail; b=sxsCT2bdh5JAOoAbEL17EgxY2iTcZlgoWEAUIforEdlrxWiazyTXml9gmDqwV9njdOK8dHnTs3rQ7gxg8o/DF0nUhoM1RSy1bQnJCRzS3fOY251wrwmXqaKWjeBuEz/0SbmqnAzLLt1mXw6iaOW4M24Rhjf9jglpUJ8fED4D03M= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706146502; c=relaxed/simple; bh=cSkNDnFUQm6911mLRD/CnJVO6Gm57SPdndxf2mDo118=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=llplrA7O3olTZQrr+AnYfMK0T6gM7d9eSEBbfz7pwDPJSDsD5DTTRMdJV9zZD3ORxncu6sxdKi3vodI/9CFoX31bFtPBLkwvjvkyHVaQbF+YOZ7ceWcx8FL+dgMI34WEXWqeSRbohCLXNTLCzjqHD13fsFkV7trobFo4kU82h00= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=jEmoUSgX; arc=fail smtp.client-ip=40.107.255.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NpmUDeV8pHMCScWG+UG4hOu6ZfUEyudKuYa/6QCunjSuYwT5lOMFe1K8M0vfirZce+NwKVJXoRpjTZ8wNZr0YyBqn5EJif1TPhd7vuLZ0Ma1fnofecntVYD+6AfHC/FRSW0ynWxMpjwBgwAQsS3q5ZiYoj/FTYZtBtoHDUiW+AqutVdM3oVi084dt880/vLFL3cJ/qACRmxvZmcyz08xVIXSfFbTmLEhB28imgZ0UGzW0hTAROjtilYZy+KLIT25aXaq3d8n9fOC5vimb4G55WacEoC3sx3K721AUNQj0QIl120OofkusjlUgqxweV1ys3OHv4dg9kNtdNFI6OCsqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Pf5uuVp5RhHLSBJBkBOFwYjJ2i9RIvaIbRqT/IbOSRc=; b=KbwUo1iIMmc/LFrZtyF5mHHy6FRCDYj9sZmKVgn1Pw6bsnlxYmdq7IOcZNHoyNzBAk/CoGVIyltsfvRA1DKxlTRQi0FI5jK2Jsc97W7Uf7fdT6y3wBg23nw1bIKtVqu9mjJDoEqpBt8LfVJbypiRDIN50xW/Eh4dnLtYbeYGwyIRbkmhX8gF6R1T/0m71sUFPg6t907ZQofMGxrdFd4BLinhMa1bzgwJX7CxsWjD6VEpb0tvg/YrP+IhCQA63kvtNn1E/bB9A3uEuTax/BocrFCayKoamuP3RguYkbkhLK03S065/qcK+LgBHFeXWO8E3s3V7l1cTpjBihnwhDJppw== 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=Pf5uuVp5RhHLSBJBkBOFwYjJ2i9RIvaIbRqT/IbOSRc=; b=jEmoUSgXPe+4CPefOGvVORpEgNVaEnIGC9S0EcWcZANAm5rhjMEvz7kMPOZ+Q5pG2FmBt7dIfWdiVzsHG8H/6Y7Qf4/KCP5Bi7yTzkphasyVrPRlXBVtDHumut7P2gqOo4cNq6W27iKIL1ygarqTNiqLZBbmD5Enbwt9r530W3UnRQCQXJvk5eRaBy2u7Z913nV9XE4uQON9LeClrp0A7npOyCmhP8v1AdQqB3Qx6gbuxt1WXwykCdWwiSOKt6qQC1kUuJHIrL+oRcsGG2f3utHqB3HY+zJdUxEvt5ZGfUQcVSYIWKoIQpcQ+jeRz47JYSsA1pEd9Coddlut7NcW0g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) by TYZPR06MB4365.apcprd06.prod.outlook.com (2603:1096:400:70::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.24; Thu, 25 Jan 2024 01:34:56 +0000 Received: from JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::1be0:ebf0:eb04:6bd3]) by JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::1be0:ebf0:eb04:6bd3%4]) with mapi id 15.20.7228.026; Thu, 25 Jan 2024 01:34:56 +0000 Message-ID: <726d018c-01d0-48b3-870b-c63fb06eb0d0@vivo.com> Date: Thu, 25 Jan 2024 09:34:53 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm:vmscan: shrink skip folios in the exiting task To: Matthew Wilcox Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com References: <20240124124308.461-1-justinjiang@vivo.com> From: zhiguojiang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR06CA0218.apcprd06.prod.outlook.com (2603:1096:4:68::26) To JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: JH0PR06MB6849:EE_|TYZPR06MB4365:EE_ X-MS-Office365-Filtering-Correlation-Id: df6565f2-070d-494c-d207-08dc1d45d635 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BgSvbK+Z4p5l9Vip2FzzCOmq6gzL4oEKnVcAYGawSm0+F9J0XuL1NQPvOT6mk3yRH/OyjhA7iFzeDl55uXDspmbQgyqF+bTR9gbQ+Uc/KamEq/W3lT+QwmPBPj+orOh2i6VRA8umoBd69Nlu6GIjtDdxRqnq2d3bykkvF/EoqkYT/nXsVJoYmakVDMh+Uo/sjzHpbodoEZXZSiPdPQA4gNd+4v/T0MUIPimP7e28j8HzkcGeEzYzLAG92A3Cwwm9wEgfB1Rquu0Vs7hI1DTrgYIPiJ5MK8jiaop75ohZkOmchgByM1mHOMRW6Dvt4vkFa1EsAcLSHU0CNaQi6AGBfFZ32bKF0hKNQgPxvoL79jB10w/avpHb1A0x1Tpu15hMtHjGS47IqKWBR06QAs1ug4TCgbpjddyyrjQq63awBD0hpuRB3n57zf9O16op1EvKkgamTE8LaVKb11Z8jF83kh40MhdJeBDkqjuuaIKY0Nc/VbMFd2+8XidBdY3uJHdafvEVVlmZ3COrC4Kr1q6IFi2zxKh3s6e2mLjLlvMrrB8O+EC8B3IGWGmBgllIheMtv/99XjokLCrvoRpR4TwgkCXEW/zm0t4CeeJqRM7yY2NWnZ3J9L7hDN/5RMY7MrGe3tGNxWCQBlzWpz2d1X5QorvEgZhQjmtVDHUB4jRdrHU7AU9a0hP3odZT6tE8q70A+w7Xdh9YQU/gyB3pAFYjhQ== 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:(13230031)(396003)(346002)(136003)(376002)(366004)(39850400004)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(41300700001)(31686004)(107886003)(26005)(36756003)(38100700002)(478600001)(38350700005)(6666004)(52116002)(6506007)(6512007)(2616005)(5660300002)(6486002)(66556008)(31696002)(2906002)(66946007)(316002)(86362001)(6916009)(8936002)(4326008)(8676002)(66476007)(43062008)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Qlc1QlM1MDBId01WZzZBWjlVZXU3dnFzZzRydFEwck14Zno1NHdsdHNhVHI1?= =?utf-8?B?QTV2V213VWlsT00xZ3F1SWx5YU5iTnVENEkyODI5YXhoYzdDUHM4cHpBUTNm?= =?utf-8?B?OUZvWlRJSkhKMy9QYTg0cTVnUnJMNzFORzN2L3NRMlp4VDFSR1pwU2NIMGVp?= =?utf-8?B?Z1lCMEFRNVdJWDlWQzVtRjZNTFdkUzlqdFRjL2hrbHZEeXBWNVUwL1ZQS1pR?= =?utf-8?B?Uy9tdkdZbG50Ym0yL2ZHZEw1NXdzckphNTVqUU4zWlg2R0lhaFI3VmFYTmZk?= =?utf-8?B?dW5zTUNBazhGeWtWc1dEeERyQXIvVHRwdEpvTitTajltcGtoUGhyVTEwaFM2?= =?utf-8?B?Vi81M1hLbDFnL0NWR2V5M0pWeW5jN3dxVW5HL3V2RW0xRXBpQ211WE1DVmlq?= =?utf-8?B?Mm1xZldJYXEzTXZ4c0J5a2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R06MB6849.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2024 01:34:56.4540 (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: ce22R8CX0DnJDMlY+RDUtWZB3mLhYccVheWvGwclvJbObUwdkGSxAnj12mfErc2yrdBiv4NAFxnlUrNuzOx+5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB4365 在 2024/1/24 21:20, Matthew Wilcox 写道: > On Wed, Jan 24, 2024 at 08:43:07PM +0800, Zhiguo Jiang wrote: >> If the shrinking folio is belong to the exiting task, this folio should >> be freed in the task exit flow rather than being reclaimed in the shrink >> flow, because the former takes less time. >> >> If the folio which is belong to the exiting task is reclaimed in the >> shrink flow, such as the anon folio, the anon folio needs to be first >> written to the swap partition by swap-in in shrink flow, and then the >> corresponding swap folio needs to be released in the task exiting flow. >> As is well known, releasing a swap folio will task more time than >> releasing directly an anon folio. >> >> In the scenarios of the low memory system and mutil backed-applications, >> the time-consuming problem caused by shrinking the exiting task's folios >> will be more severe. > What testing have you done of this patch? How often does it happen? > Are there particular workloads that benefit from this? (I'm not sure > what "mutil backed-applications" are?) 1 Yes, this patch has been tested. 2 When the exiting tasks and shrink_inactive_list occur at the same time,    the folios which shrink_inactive_list reclaims may be the exiting tasks's folios    in lruvecs. And when system is low memory, it more likely to occur, because    more backend applidatuions will be killed.    The shrink_inactive_list reclaims the exiting tasks's folios in lruvecs and    transforms the exiting tasks's anon folios into swap memory, which leads    to the increasing load of the current exiting tasks. 3 This patch can alleviate the load of the tasks exiting process. This patch    can make that the exiting tasks release its anon folios faster instead of    releasing its swap memory from its anon folios swap-in in shrink_inactive_list. 4 "mutil backed-applications" means that there are a large number of     the backend applications in the system. Thanks > > And I do mean specifically of this patch, because to my eyes it > shouldn't even compile. Has been tested.