Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp748423rdb; Thu, 30 Nov 2023 18:24:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHd73R+u3PHGsVW0XYvC3Fx97O2Z0MNOOCrEbmCwXI3cVedzv58L4VRk+cNCjBY6jY/RKbs X-Received: by 2002:a05:6359:4e93:b0:170:840:5629 with SMTP id os19-20020a0563594e9300b0017008405629mr1336812rwb.18.1701397465847; Thu, 30 Nov 2023 18:24:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701397465; cv=pass; d=google.com; s=arc-20160816; b=ZSgGOhv4thjZBDenxQxJF5oRT+gPBaZgAl6oENUNcLfpvBp31h6vIPFG8IgIHM5Yrx B2HMOaOtYzdRC9IohNNfEtx4Wg8d4ETCICWjHURwwc3J2qgskRAqRInIPJwkJDsD88I8 lIkvz2QbR5j7QBJHjG+Q+4e35E2JARqywG6CEiQtOIP8E3e/03dy+uh1+BfGqwUc1HVa ITZx4EXRlTXXHtHd7mLYSKW+bsBh7TquQfl6/Jo7zo//icxMQG1gFX94DRfpRMHildN4 v2iSbvXUTl8JOH63Ou8PZ+Ada59f7YuoDmA3BEqaX6ItWJb0ILjhhlxuW1EdfKibOmei RsZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:subject:user-agent:date :message-id:dkim-signature; bh=cWJ7xAO3+0dD+0sMIHRGKOvzKUeGm8oJyXiudKV0OXw=; fh=aUB/loZFFO2OnR+GYH2HKI0sP10W1nfKfexcTvhSJHw=; b=NrIK7j/WJqiREW1OnlB4mEzJcB7HtDdXePbfq9w8eiCbi9d5J0AzLLIjJk7XvsnKVy f0DWj6obxxaPkzxpWofY1dEeH5RbQrwDBzIEaH4n4ZHyvhPpqXPDBIHYRZa6JDgKGna/ pLDTe6mgSJ5nUHxTYTlDSVYatrojRGTWJs9gChMLtSbANFHcKcdctymipKjRSOvh3CWi p86fxHpKv2VinDdpsii1kzzgF1ZpFH9jbTxksKqs/AjAjXhJOeJFa38sN9szhmIgsSn9 9TPAaZdYJ3GliaH3tzaWUXRKuJyp9ebsJ0yFB44LQJ6EHvwNwfdIlORgg33AkcLl8bBL Xf7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=XxdwcsaE; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id r9-20020a632b09000000b005ad1edab539si2391652pgr.319.2023.11.30.18.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 18:24:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=XxdwcsaE; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 425408705E82; Thu, 30 Nov 2023 18:24:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376625AbjLACYH (ORCPT + 99 others); Thu, 30 Nov 2023 21:24:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbjLACYG (ORCPT ); Thu, 30 Nov 2023 21:24:06 -0500 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2108.outbound.protection.outlook.com [40.107.255.108]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9852A115; Thu, 30 Nov 2023 18:24:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VQeyKqXS7H1O9HGAsIjaYYVHJT6n2y4dhrtNLQPrmYX7M/RePWxo6xmyF8nUMWOcWfF50e0tkx3Qbf/gQZMekYSUMNbWGuymRWL5gL8vOPsKmL4CljDPk/tRd8JOLhDLjyt19BkYJ70LAY4JngHWUGEDVP3kvYhepan1a7X2hMNjxVBxpbUW7dG884rVEygHiuZAVOsllgF6lfQijGrlCGkfaa8YurhDPEgogVp3zvPFLCkZeFdwsxrJyqDmtCywK+XDBErUmRKLIFKcflyY2pKBfFO+K/bJahnfHwDAeK2NiBiioYknj2Qc+pMYg9NXuvSlClc8nsUQ1GQ9kO8M1Q== 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=cWJ7xAO3+0dD+0sMIHRGKOvzKUeGm8oJyXiudKV0OXw=; b=An0lIygazgz/5jlScZwt0NeHXfahC83Nd9ElhaA20GIk3JngN0NxM8YaTcvbi/wDM6HYPDTX5qObQl1D1iVkZiysQnptN6hJFWTXa3G46lJmemaChPe/ckv5ithfQIKXHOcfWWi21oNrL0x3Xhmwqy7FDhXZJpuEgPrW4XK9v+kky9evDuEVDdh6PVzlBo9RAVgqiM4wc3HcxkknQY4+HzrH8sfedgCleVdJY20/qiPVK9Ux+qI7clnz1ugsIxsO3aPbt/uyrj7cdHmIKH0kcwEEtsmnpag5gJkTWAseF1I5qgq8d6tpdzBbSH0JsBw8MeMkS0w9K7PA1PYwfySgTQ== 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=cWJ7xAO3+0dD+0sMIHRGKOvzKUeGm8oJyXiudKV0OXw=; b=XxdwcsaEXEh2y5ass9ljwqoWGcEFLCXonJRFIjKirTUaCzft/QFri+Hg4hgzfV4MCxa/zF/pf3LpqdxFFiC84eHmJjFJzdQf2NqakhYSdoACg6vQ4Y1e7OAxgGAdrmReLhv3JvumEV3+kfI0fwxVcK+iFixBL5EiOhWh7iYhcwZYdvY+xsIbqBsAZnV1/L+iAJ2jtAa1BlLdwXAxQx3fYSzQDnqR/zQjsShcM5olvfzfX1s5wQE+O+XNR71vM3NpVGB76+SOkxW6m2JXauzHYTjmdti1u4xAlBeRUJnMtYXy8SEjQvpGNBt9aBtyNSDgs3hiCrpTqE0f8orKWPm6sA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) by OS8PR06MB7324.apcprd06.prod.outlook.com (2603:1096:604:28b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.24; Fri, 1 Dec 2023 02:24:09 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::d754:7b3:dc4c:6b48]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::d754:7b3:dc4c:6b48%7]) with mapi id 15.20.7046.027; Fri, 1 Dec 2023 02:24:09 +0000 Message-ID: Date: Fri, 1 Dec 2023 10:24:03 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/1] mm: add swapiness= arg to memory.reclaim To: Yosry Ahmed Cc: Dan Schatzberg , Johannes Weiner , Roman Gushchin , Huan Yang , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , Shakeel Butt , Muchun Song , Andrew Morton , David Hildenbrand , Matthew Wilcox , Huang Ying , Kefeng Wang , Peter Xu , "Vishal Moola (Oracle)" , Yue Zhao , Hugh Dickins References: <20231130153658.527556-1-schatzberg.dan@gmail.com> <20231130153658.527556-2-schatzberg.dan@gmail.com> From: Huan Yang <11133793@vivo.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI1PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:1f5::18) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|OS8PR06MB7324:EE_ X-MS-Office365-Filtering-Correlation-Id: 6fa4b345-f8e8-4335-46b3-08dbf2149965 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iNPDxCsJYZUDZoYW4im/JqLj0GDK0sK/vcGWuFnihDV9oG1J+G/nA1xo8ym/37OBjx+RrcRc+cVE07TRjaGfcvOOipL4TK9Bf7PyfL/enZtYdD9M2CVMtjECMxeS3cPTEtKhDt+bWWrF6ZlreL2Tdzd7l2qLbhOYdKTGGSw97j5EF55Y3XpxoTXSEvlr/GbNL6+C/+njgp0LileQlM27x06W3VlgcqXXhIl5ij/GUq382SlFhkwg2ZebLwW1SfInHpCr0ICP3uZjhMPG2+DazG7ZWE68Hw9MsPTpbXkVDuilT4qVt7ucwfuZfcZQfCH8yHlxyaqLO4pxkXk78Af3FUlAN1kmodJ9JwhSazB9cC3gT6fCq+3R0A9ZXphExLrVhnWLy7Vs1HC+huKsRHHuIwpBsVqqaJRwo8NgvsMcBlQvdLBYbZ4/g/pEo1X8+A8quIfL82N9Scs40vyGU4E/sJuxHcjHf8ZjeRfMXWUWkKzSQjmZw5s/+13ylQfBwKLhF9UJvIAypuaDrsyzC+KC8Z0cKldm8SXsiczCoDbHuTUBD9fAF3hKsOyKSOjYNFvydKt5HSB57U82P+GQRlq4PwZdOSoLobpqbpjKPx1pfMxFecHX2u2uQOtc8LrnlRf6dDQrhCyUWu8mAtCWCZeRwHOA4tC/3Gje+m8aUXaBjWku2PEHApfPGbTMhlzEdC17dzfN21euBe4vNIIWqm5jvQ== 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:(13230031)(396003)(39860400002)(366004)(136003)(376002)(346002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(31696002)(31686004)(316002)(4326008)(8676002)(6486002)(478600001)(38100700002)(8936002)(36756003)(5660300002)(54906003)(66476007)(66556008)(6916009)(66946007)(7416002)(2906002)(38350700005)(6506007)(53546011)(52116002)(6666004)(41300700001)(6512007)(26005)(2616005)(83380400001)(81742002)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZVl3N1lXVmNvYkMzMGVTazFmeFpyVGtkMjMrelhhMmt6UTV3TTZGNXhnSWxT?= =?utf-8?B?aUpQUUo4ZFpacCtjN2VoSDFRd2dBMnViUlVLQ0dOdUFCMWVH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Q2a2V5Y2RlRnE4NGVramhtS3ptNHhPTHpTN3dVR2I5MC9Vb3QvVnAy?= =?utf-8?B?T0J4aXJoMmRSd2dxWEZYcGIxcnFRSXVIWVZ6OG1oRS85cklPTVVkcFJFd3ZF?= =?utf-8?B?YlZobTJoczU0OWFPYmoxN3VUcnJvNDBJMHcyamxyM3J3TjVDSEhBMndaZHE5?= =?utf-8?B?MnNMUGdIRllueDVnaXk5dmlvNkRDaityQ3pURVA2dWsxcE5zN3hOM1k4enRF?= =?utf-8?Q?70RE6QtMaJ+D6RwdAEDnwVGTo?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6fa4b345-f8e8-4335-46b3-08dbf2149965 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2023 02:24:09.2363 (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: p078xhHm1NnshdxDpYgaURMScd3o6ZMwVJFGV0EZS/uUieqU1mv+P4wVZWEyX/mly1uhqHedFWg0P0sNxxfAVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS8PR06MB7324 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 30 Nov 2023 18:24:22 -0800 (PST) 在 2023/12/1 10:17, Yosry Ahmed 写道: > On Thu, Nov 30, 2023 at 6:14 PM Huan Yang <11133793@vivo.com> wrote: >> >> 在 2023/12/1 10:05, Yosry Ahmed 写道: >>>> @@ -2327,7 +2330,8 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, >>>> struct pglist_data *pgdat = lruvec_pgdat(lruvec); >>>> struct mem_cgroup *memcg = lruvec_memcg(lruvec); >>>> unsigned long anon_cost, file_cost, total_cost; >>>> - int swappiness = mem_cgroup_swappiness(memcg); >>>> + int swappiness = sc->swappiness ? >>>> + *sc->swappiness : mem_cgroup_swappiness(memcg); >>>> >>>> Should we use "unlikely" here to indicate that sc->swappiness is an unexpected behavior? >>>> Due to current use case only apply in proactive reclaim. >>> On a system that is not under memory pressure, the rate of proactive >>> reclaim could be higher than reactive reclaim. We should only use >>> likely/unlikely when it's obvious a scenario will happen most of the >>> time. I don't believe that's the case here. >> Not all vendors will use proactive interfaces, and reactive reclaim are >> a normal >> system behavior. In this regard, I think it is appropriate to add >> "unlikely". > The general guidance is not to use likely/unlikely when it's not > certain, which I believe is the case here. I think the CPU will make OK, I will remember this part. > better decisions on its own than if we give it hints that's wrong in > some situations. Others please correct me if I am wrong. No, you're right. CPU is good to do this. > >>>> u64 fraction[ANON_AND_FILE]; >>>> u64 denominator = 0; /* gcc */ >>>> enum scan_balance scan_balance; >>>> @@ -2608,6 +2612,9 @@ static int get_swappiness(struct lruvec *lruvec, struct scan_control *sc) >>>> mem_cgroup_get_nr_swap_pages(memcg) < MIN_LRU_BATCH) >>>> return 0; >>>> >>>> + if (sc->swappiness) >>>> + return *sc->swappiness; >>>> >>>> Also there. >>>> >>>> + >>>> return mem_cgroup_swappiness(memcg); >>>> } >>>> >>>> @@ -6433,7 +6440,8 @@ unsigned long mem_cgroup_shrink_node(struct mem_cgroup *memcg, >>>> unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg, >>>> unsigned long nr_pages, >>>> gfp_t gfp_mask, >>>> - unsigned int reclaim_options) >>>> + unsigned int reclaim_options, >>>> + int *swappiness) >>>> { >>>> unsigned long nr_reclaimed; >>>> unsigned int noreclaim_flag; >>>> @@ -6448,6 +6456,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg, >>>> .may_unmap = 1, >>>> .may_swap = !!(reclaim_options & MEMCG_RECLAIM_MAY_SWAP), >>>> .proactive = !!(reclaim_options & MEMCG_RECLAIM_PROACTIVE), >>>> + .swappiness = swappiness, >>>> }; >>>> /* >>>> * Traverse the ZONELIST_FALLBACK zonelist of the current node to put >>>> -- >>>> 2.34.1 >>>> >>>> My previous patch attempted to ensure fully deterministic semantics under extreme swappiness. >>>> For example, when swappiness is set to 200, only anonymous pages will be reclaimed. >>>> Due to code in MGLRU isolate_folios will try scan anon if no scanned, will try other type.(We do not want >>>> it to attempt this behavior.) >>>> How do you think about extreme swappiness scenarios? >>> I think having different semantics between swappiness passed to >>> proactive reclaim and global swappiness can be confusing. If it's >>> needed to have a swappiness value that says "anon only no matter >>> what", perhaps we should introduce such a new value and make it >>> supported by both global and proactive reclaim swappiness? We could >>> support writing "max" or something similar instead of a special value >>> to mean that. >> Yes, use other hint more suitable for this scenario. >> >> However, from this patch, it seems that this feature is not supported. >> Do you have a demand for this scenario? > We do anonymous-only proactive reclaim in some setups, so it would be > nice to have. I am not sure if it's absolutely needed vs. just using > swappiness=200 and living with the possibility of reclaiming some file > pages. Right now, the scenario where swappiness=200 is sufficient for us, but having the tendency to only reclaim anonymous pages has a clear semantics that is suitable for upper-level strategy scenarios, rather than relying solely on the functionality of swappiness.