Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp155252rdb; Wed, 18 Oct 2023 23:30:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAO5nkZMmMYuJlSIH6R6vZxTRmvoAnECpPlVLqYPS5HEMjRxjGgD5eyYPpptg2DpS7Y5n9 X-Received: by 2002:a17:902:e1d2:b0:1c6:2f59:8c4d with SMTP id t18-20020a170902e1d200b001c62f598c4dmr1033084pla.28.1697697044200; Wed, 18 Oct 2023 23:30:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697697044; cv=pass; d=google.com; s=arc-20160816; b=zHaJwgG4iS+/xFxrsEQ7w+Gf53DjABNxCcdCSOVsibX2FaE89R0e92GpLLzN6WtHjM 5oYDhEhiNNxn64MeArnA2Qkg+7p4dhe951TvJkGVmdt04JBuDktpvwnYZH5dChgmXCSm vctOAGC9hrOirCN74/VmIpbPKEYUZhb7TCaHw32Tlk6i5MDgdYLq4bvWtG3PPvn+q9ND P/6fBn47TeXgJ7lIa0iHQl9CIDZ03gxORLgdhIB6jdM+PN/R/kL0ezKPpET3PYYCfIUZ 0OtIu9Apdh8uhqOkcB1AlvQlAhsbz88eOXHFIuer9ef4W1BiQ0F1KcielIfnbBbwpskB TWeg== 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=uZxj8oQmPox297DV5VycbP1JaphezX81E1qPpoYP1N8=; fh=zxUdFLs5vA/2oJNRKZuLb8weWgU5OgJB9OCfG9uCzSc=; b=PHOqAPliwEylse922Zmgkqbln7S6Z7+zzRqtpwTRZNxX0s4htxg6GID7vg3rKrtDQz Hi27zmbtwJ27HWNwOtwHLQBGm+9pgyCN5MWqY1XqdKQeWH6wEaprY8nC+vExQhhKpglp GeGfs+vLYCf8s9QzpTKgmAfTrnT9dLKTA6qqfgYh4CL2m9YfC+JZMz0jLJnfyqDpSejn VjQiaWz8dblKW+Mu/n/zReHVmt/TxE8UtdbtGq/VlLyDN80pr1t3n8tWGWDSHvJDrhuf sYCRsPchYqZhC5qezPuBZ5t26uNcPCu/wuqbxlIjf57mDv1e4eZWWl+AYrQ78TpLq9qq gYTg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=WoS9WVZF; 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 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id k18-20020a170902c41200b001c61226fe40si1662654plk.392.2023.10.18.23.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 23:30:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=WoS9WVZF; 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 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id C7F728078E39; Wed, 18 Oct 2023 23:30:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232383AbjJSGaJ (ORCPT + 99 others); Thu, 19 Oct 2023 02:30:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbjJSGaG (ORCPT ); Thu, 19 Oct 2023 02:30:06 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2104.outbound.protection.outlook.com [40.107.255.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EAF7BE; Wed, 18 Oct 2023 23:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=COUmDmDWBXhsFWoJZEut54JIA3xAKINWG3se6Uyn6ex2Hb6rEOJfM9i9z3UVVl20YcQy0sbfonE1DJbfceZzXQU81+1BWwhvZOZ6AcuvnXf6EbMA/AaSoxz0V42gLLV7UAAXGm4GVyQNuSd1u9JvzyMFKoSv1pOZctkx0kI/8dHdlneGANyb2FChmSpmQqAZtrCrpFNVU4AFBcYU3moq4KZNkecvOsOz/DwO0iC/Gsv/ss2RtMmCaAebcf0eHuSCWpc6Pu/HEpJNNVaugOXeSGjxccx19ZEuuto6wNCdeXfyZjnXTQOGnFncx/L1gHv/HZ/G5C5T0gUP35H57ghEIQ== 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=uZxj8oQmPox297DV5VycbP1JaphezX81E1qPpoYP1N8=; b=KEAYK85J8pCwrsxSevcGJmqsbAhzO4F0Ueh8BRPk43JOdsRrdbEuRT+uM8cUReZWQ67H4t4ihAbKkRKAUC9wNtBOKpC//DV8Ga0Ph0q7fhmif9qgBZgUx8Abh26oQbmKlgi07Wsk8uiQUz2khw/fBi2yOEQVTG025koT9pPew16oDCrZHW6/6bs0Htlpo5GBKjmVi2LhHfIXvhTp+sc+i5EoykhIPVjiN7xPTNA/lW58H/xA97+DDEZmv7vVbyMp3k/eIRF/XoMdx9nUSLTvcCsqHO3/+lIXxQa3eRw9hUXAcY1lILIw8FGnH9ZF8tY2YcvDzcqtphYN7mPfhi1jJQ== 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=uZxj8oQmPox297DV5VycbP1JaphezX81E1qPpoYP1N8=; b=WoS9WVZF9hxLeFSnCzQEQa7oV/YJYo6gbBU19RYC7Li/vPV1fWXTCpLSIeDB/tMQWwCvSck8hVKXovW4l67ZyRnhCh79hLG4PlubGlWSJuMtXyFZgQ/34fwGBW9yJrpvP1tvEpOwYIaSDMPcvJkBHdu1Asai64FEc6odRgcmLR1D6MMHXZGj9B9LoAw2Xn3KJaQAUscD0qXPMquuAfErM8DVBYG2Yiarlhd4TKnySR3xLFixJmr/19Z29f7fJohKZxsk7zvNxU22plK9S7+DO48VbBfCcCPN1oTlf7o5+KAksYAZs9ZnmrsQ57t5Lzbr+Bmud6uKp/ZOuBJA62mczA== 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 KL1PR06MB6985.apcprd06.prod.outlook.com (2603:1096:820:11a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Thu, 19 Oct 2023 06:29:57 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::40ac:5701:4617:f503]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::40ac:5701:4617:f503%4]) with mapi id 15.20.6907.021; Thu, 19 Oct 2023 06:29:57 +0000 Message-ID: <233c1c9b-963b-4129-b26d-f1f74c8595ad@vivo.com> Date: Thu, 19 Oct 2023 14:29:52 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] mm: multi-gen lru: fix stat count To: Yu Zhao Cc: Steven Rostedt , Masami Hiramatsu , Andrew Morton , Suren Baghdasaryan , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, opensource.kernel@vivo.com References: <20231018082104.3918770-1-link@vivo.com> <20231018082104.3918770-3-link@vivo.com> From: Huan Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR04CA0192.apcprd04.prod.outlook.com (2603:1096:4:14::30) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|KL1PR06MB6985:EE_ X-MS-Office365-Filtering-Correlation-Id: 83e6445b-13a0-45bb-ed53-08dbd06cd004 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P3gFNUFN8Fb8L3xj6mW/hM5cqYX8vqycIW16A5wCFBVgdBqx7mBYsVU5lV9a86r7/i0lb8ZiWGJFuDSLkFzlwbroHkKhP+3x7d3w9W5JUTfGFzBloncCeL9eJbqUTrFioGRU5FsM90qgs/lpgozF3NHg5gluftZa8ECGKZAF9kbzHJZ6m6dFU6taoxOMIj6jbU6MpvG7dQl0BIeIUF9GE/tGfDFmhMcxceIhOeeJ09d3YE/SzB4l/HTvp4Oom69CzRVgL/AZ0qsIDASxNGCorTy7IFEE3eT52p0eWb0s/BWmCeXfs84UjyIqgFmTILhRL4vMCTOZnV+9ZgziEvih7y0DiAMzn72y8pJchEcNLXY0VdFYvwXt9ZzT9oM5uIuk3ZrsMnuwA86G/qmi4on3ZXFjGNTNrHNYPQPbrICWYI09axaPd7x1H1Nx1I91ZzHMyh1njO94RfACiedEp50dlaa881jUZjONHd3HMzED4XLfnPDyyDNyDaHBqmp+Loa/9GI1+F1wOKdaL6wD0fm69PfEWRK3CrA59Le1JzyMnbSXTfirR0/p04Zo5UnDrdu1IdXb/6f1r5BwZbBuouJ6mxE6htBovC3pT4hXu8ZMBEbIEc7YeiM4GX1R2gBiD+7Rh02hqORaHN/ZrUHxk02zOLmOb9kFld+8oyn+5n+5c8ysBorQTeXnZ7Y4RDBT0CRp 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)(376002)(346002)(136003)(39860400002)(366004)(396003)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(66899024)(5660300002)(4326008)(66946007)(54906003)(66476007)(8936002)(66556008)(316002)(6916009)(6666004)(8676002)(6486002)(478600001)(41300700001)(36756003)(31696002)(7416002)(2906002)(86362001)(38100700002)(52116002)(107886003)(2616005)(53546011)(6506007)(6512007)(83380400001)(26005)(38350700005)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Lzk2dXZ0NStEcUlHNy9wUUtFUDc0SFVRdVZTNmFBbkh3SDRJMmlIM0tWZE1T?= =?utf-8?B?akxBbXl6QXk2TEJBWXdaVWNtMkpreExxM2RBVlBsS1I5SGVVOXNUek1mbkZj?= =?utf-8?B?MHdkTVBzdkRrUFlPYXVjeHp3bTlpckc0dmFTNTVTa0w1SWhZRWlWZUkvaWln?= =?utf-8?B?R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VDBVWVZteG1MSUpDcnppbGUwcWRMbzJvL1Uzdkla?= =?utf-8?B?NGZxVllDNnkxd3pLditneU9DbTZDb1VaRzljR0l0NmRwY2dlV3FZcWxDbmNt?= =?utf-8?B?NmVINkFQZzI3U2htZWNNR3U3S1hGczlRNnBjTFlSQngwWXhqQnl3VlpoSERE?= =?utf-8?Q?TT7Fg3iya1ZiARL/gJBp1fkN5?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83e6445b-13a0-45bb-ed53-08dbd06cd004 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 06:29:57.0558 (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: N88OmP0g95w0zPqvJz2Hr8ZaficMXvT/qnsC41D7Fk2uowGbMcxIm+64nLBQpwR/C7Y3oq5EZeCHQEePyuIfxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6985 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Wed, 18 Oct 2023 23:30:22 -0700 (PDT) 在 2023/10/19 10:39, Yu Zhao 写道: > On Wed, Oct 18, 2023 at 8:17 PM Huan Yang wrote: >> Hi Yu Zhao, >> >> Thanks for your reply. >> >> 在 2023/10/19 0:21, Yu Zhao 写道: >>> On Wed, Oct 18, 2023 at 2:22 AM Huan Yang wrote: >>>> For multi-gen lru reclaim in evict_folios, like shrink_inactive_list, >>>> gather folios which isolate to reclaim, and invoke shirnk_folio_list. >>>> >>>> But, when complete shrink, it not gather shrink reclaim stat into sc, >>>> we can't get info like nr_dirty\congested in reclaim, and then >>>> control writeback, dirty number and mark as LRUVEC_CONGESTED, or >>>> just bpf trace shrink and get correct sc stat. >>>> >>>> This patch fix this by simple copy code from shrink_inactive_list when >>>> end of shrink list. >>> MGLRU doesn't try to write back dirt file pages in the reclaim path -- >>> it filters them out in sort_folio() and leaves them to the page >> Nice to know this, sort_folio() filters some folio indeed. >> But, I want to know, if we touch some folio in shrink_folio_list(), may some >> folio become dirty or writeback even if sort_folio() filter then? > Good question: in that case MGLRU still doesn't try to write those > folios back because isolate_folio() cleared PG_reclaim and > shrink_folio_list() checks PG_reclaim: Thank you too much. So, MGLRU have many diff between typic LRU reclaim. So, why don't offer MGLRU a own shrink path to avoid so many check of folio? And more think, it's nice to assign a anon/file reclaim hook into anon_vma/address_space? (Each folio, have their own shrink path, don't try check path if it no need.) > > if (folio_test_dirty(folio)) { > /* > * Only kswapd can writeback filesystem folios > * to avoid risk of stack overflow. But avoid > * injecting inefficient single-folio I/O into > * flusher writeback as much as possible: only > * write folios when we've encountered many > * dirty folios, and when we've already scanned > * the rest of the LRU for clean folios and see > * the same dirty folios again (with the reclaim > * flag set). > */ > if (folio_is_file_lru(folio) && > (!current_is_kswapd() || > !folio_test_reclaim(folio) || > !test_bit(PGDAT_DIRTY, &pgdat->flags))) { Thanks