From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A68841A503 for ; Mon, 24 Aug 2026 12:45:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787575502; cv=none; b=fVZ+ljuMxejnrHjFVS+3a3mmwwKQyP0CHTGajfixWLFKnXEBywy6bzMRSA8V/LWs4Qqm0e1J3t4I8GbZBFcglCHUT9GGxwLVeE08P7FXGKo7KEZo6rIVESv15zUmX/QP1JMn3q55kZGKZ4p7aADhpyqa6oRVyYNDSArLNGzr7VY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787575502; c=relaxed/simple; bh=DW3UtFqD/zu7mAy58si3FQbh8UaK2UOfbrSUpkOwrLI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sgT5ujTAyI9fZ+j0B+ZrooXugEEl4vOPJJfDr5N5z3y8pvdrCk3JJyVn4RDPO1/0yyhfhBAoR7I8tYNNhp9fgIJcsOQNRUR0CskZm3KM+MABLA57kWnOLTNFSgcWtliNblVUZsUnI2/u3pcIPwNZTm9SEfiPUwRi1gs/Cf2uNuM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E0ryj8B2; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E0ryj8B2" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-8485ef63b68so3030982b3a.1 for ; Mon, 24 Aug 2026 05:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787575501; x=1788180301; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=E2yHo0M2FJBuTCpqN8VZyJQ8Wot3WXvI786J1PIQoT0=; b=E0ryj8B2muDgi6S5xmFrd3XU9eXVxvuX6mEsoaaGAXFez5obMYEuGIVvsVpwQio6q/ JMG4CBfGu2cUq3uKS6KKZ4s+5sf5Tpbz4Q7y7LAJ2G+OV721Q8JAcPcOHUWobRX+2C9d Yx9hlVkpLuzrpZRl8vh9I2bsNqETxztDhnrOuNGfQopjwwUwI/VaJl42OnjfUcsQ1loQ 76FNF1SulznMRN/UVYZJg6BSk57//X05LdyZBRyEAyZ9WUAlKxTHlfRPRnyAw3FuZy3b zNabhPe7bhL1HHttbczIUNpBo2VSxXa9Bzvr7HH2B0uYQcL2hJxRaQGJo1NN6eYabNFt 77Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787575501; x=1788180301; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=E2yHo0M2FJBuTCpqN8VZyJQ8Wot3WXvI786J1PIQoT0=; b=rA3p/BUjJaSWOhUz8If5NCqXRUjddxp3wSmwSqOSpDsh8bP6vCFf05yvSKZFf2II4P 6fe1C91+H7r6JyQkw5ANsLLLiPtzfwjLM0wdvbDLvtXPGOubX6sIewWfxg/9YTBDdj4J QFxy+2J2OIjArWs27KugxFbztck2BpjeBIEPD8If28XOsrlB0DknMlyyY739QYtVqPHL eS/zEMd7R0FwzHKyXzmCPn+hHAA6/4tnmfhnJy35RVXxnm4C6mTpNNPKy9MMv7xu+0mP dW+w7pSdeQfIEZIs2Wf7t7YVu/DcHqQTmf2PCP3PpfwjU9wI3/uIOBLAv+PmFRkU6BPX pfPg== X-Forwarded-Encrypted: i=1; AHgh+RoX3eajvunEE9p4ctam5hz6tShJmkmbHAZdDiDsZ6ZaK/nkdA5pO7gAmU5ToCgabPE4BdoDSdKtH5SoJ/w=@vger.kernel.org X-Gm-Message-State: AFuF++mZUUYc9kC6kiC1lWRVTWP7uLY8HAupsBYAdKZS3/Ml0sw9o1Uj 9rBZORjYApud+bqnevZp3WXI8nXui2DcwGNMkYr6LHQ+688cGGq4D5l1 X-Gm-Gg: AR+sD11wo/mx2uId4eUDATrkT2uNsZ6CNTJfe9i7I45z9zaHpttZN6IWCJqLt1xOKhl Hynfg4mDb2wQPU0QxSSJoj05FkmnphdY3z5QSX9xwdn+5l8n5USLCyakwrvW6D0OuqwyX0LAzpA tU2E+48G9VNDKyKpUdZyyF7+218erQ0RCXvVsPRU+xnYLseEcDF9dRrFgBCs9/tnOfRSacCjw4k /9/p8w9CB0aG1bf/D2S7/htn8zuYjN5Q2h/Db48q3Xq+lZvufjy6G9v7GHq3jM5II6//tmTmuF/ jGf5frlZj/mrqWwMfoFWs/Iq6Omds5os6jXB1mdIJ+xCU4/sp18AG3Pfb5409HVoQGwEdsGE4ew vHpwMnvZC+dZDt/kF9aIfSOnK+6/j9j0kn0HnLQo7AUZcxJ2lOcJbkU7KDZqd8nylooSoBVo22/ f5qLnyHty59/p4q3iJaOhyfxalcH6trxBMSFhi82Qh1bJ66vUwDD+BL94R0samaDMq6S94UprE9 0kKhyIu7WKNbCudok5R23X6 X-Received: by 2002:a05:6a00:2998:b0:848:2ab3:ddeb with SMTP id d2e1a72fcca58-851f9fc70e9mr45280869b3a.14.1787575500815; Mon, 24 Aug 2026 05:45:00 -0700 (PDT) Received: from KASONG-MC4 ([101.32.222.185]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8520f03b014sm1911847b3a.36.2026.08.24.05.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 05:45:00 -0700 (PDT) Date: Mon, 24 Aug 2026 20:44:51 +0800 From: Kairui Song To: Baolin Wang Cc: kasong@tencent.com, linux-mm@kvack.org, Andrew Morton , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Shakeel Butt , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Chris Li , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Yu Zhao , Zi Yan , Qi Zheng , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/7] mm/mglru: move max_seq read into walk_update_folio Message-ID: References: <20260818-mglru-flags-cleanup-v1-0-8dbbdac0d28c@tencent.com> <20260818-mglru-flags-cleanup-v1-4-8dbbdac0d28c@tencent.com> <52215f41-9297-4197-982c-bec01b485bb7@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52215f41-9297-4197-982c-bec01b485bb7@linux.alibaba.com> On Wed, Aug 19, 2026 at 05:18:51PM +0800, Baolin Wang wrote: > > > On 8/18/26 1:38 PM, Kairui Song via B4 Relay wrote: > > From: Kairui Song > > > > walk_pte_range(), walk_pmd_range_locked(), and lru_gen_look_around() > > each read lrugen->max_seq to compute the target generation used by > > walk_update_folio(), then pass it as a parameter. Move the read into > > walk_update_folio() itself so the callers no longer need to compute > > or pass the value. > > > > The max_seq read now happens once per folio update rather than once > > per walk range, so folios always get promoted to the current youngest > > generation. > > > > Signed-off-by: Kairui Song > > Reviewed-by: Baoquan He > > --- > > LGTM. One nit below. > Reviewed-by: Baolin Wang > > > mm/vmscan.c | 29 ++++++++++++----------------- > > 1 file changed, 12 insertions(+), 17 deletions(-) > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > index 080132997d87..a819be6b7ae9 100644 > > --- a/mm/vmscan.c > > +++ b/mm/vmscan.c > > @@ -3517,13 +3517,15 @@ static bool suitable_to_scan(int total, int young) > > } > > static void walk_update_folio(struct lru_gen_mm_walk *walk, struct vm_area_struct *vma, > > - struct folio *folio, int new_gen, bool dirty) > > + struct lruvec *lruvec, struct folio *folio, bool dirty) > > IIRC, MM maintainers prefer 2 tabs, which is why I changed this earlier:) Thanks for the info! I'll keep this line untouched then, my editors auto indent always align any code I touched to the open bracket that's why this line is changed :)