From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B3E272AD3D for ; Fri, 24 Apr 2026 14:10:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777039855; cv=none; b=IZn46LhnbieHbFsnRwlw4bOh0UCIiNH8uWmb6e1UnomOwlrRvDw08vBBU24nujP6i4bbdp5I9v9jARKn4q4Cp17J8RAKuN8OHjyKzI1BA/V9g95sE/jS/wKEkJ7JmxX7h1qjqZlDn3rp1GFqIEqZfCpEr7LWgQBTCsdVAD2JU1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777039855; c=relaxed/simple; bh=FufG6rtOJWdODqqVpGjpGMYcAJMiCngdvLFaGNid+qk=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=cNqAyilAa7E4q6BY/EtqZoNrKnsRXoH3R6QTgvoss6cFtq4TQKQNQt+gIh07tgaRIaD1WdmzY2oAgx9gU6CS0RXhL5q7y90dUB/SI47CpOpgT15ME50suo8E9XFvOFYOfabr5k16qwtJm1ddC6d72sRmmQmG5C31Lff/7dPSS10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=bzPvRblR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="bzPvRblR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAFB3C19425; Fri, 24 Apr 2026 14:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1777039855; bh=FufG6rtOJWdODqqVpGjpGMYcAJMiCngdvLFaGNid+qk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bzPvRblRAgWfGDJ7LfEC5oGo+p7osBdjVsD922f2zO24o5OYJDcAOIrb3XQ5injHS 9CqvY3b/kT5zTdbtGnRxCHTXl0jDn1JUs2jg6wnEmA/9ZMTuTo7eQRX2ThUdvYBaM3 ihPGn6zGGppfoN/+n3cK06na1M6QE5loNKzNr5lw= Date: Fri, 24 Apr 2026 07:10:54 -0700 From: Andrew Morton To: "Barry Song (Xiaomi)" Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lance Yang , Xueyuan Chen , Kairui Song , Qi Zheng , Shakeel Butt , wangzicheng , Suren Baghdasaryan , Lei Liu , Matthew Wilcox , Axel Rasmussen , Yuanchu Xie , Wei Xu , Will Deacon Subject: Re: [PATCH] mm/mglru: Use folio_mark_accessed to replace folio_set_active in PF Message-Id: <20260424071054.3a4a09c61007e0c24d9223a1@linux-foundation.org> In-Reply-To: <20260418120233.7162-1-baohua@kernel.org> References: <20260418120233.7162-1-baohua@kernel.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Sat, 18 Apr 2026 20:02:33 +0800 "Barry Song (Xiaomi)" wrote: > MGLRU gives high priority to folios mapped in page tables. > As a result, folio_set_active() is invoked for all folios > read during page faults. In practice, however, readahead > can bring in many folios that are never accessed via page > tables. > > A previous attempt by Lei Liu proposed introducing a separate > LRU for readahead[1] to make readahead pages easier to reclaim, > but that approach is likely over-engineered. > > Before commit 4d5d14a01e2c ("mm/mglru: rework workingset > protection"), folios with PG_active were always placed in > the youngest generation, leading to over-protection and > increased refaults. After that commit, PG_active folios > are placed in the second youngest generation, which is > still too optimistic given the presence of readahead. In > contrast, the classic active/inactive scheme is more > conservative. > > This patch switches to folio_mark_accessed(). If > folio_check_references() later detects referenced PTEs, > the folio will be promoted based on the reference flag > set by folio_mark_accessed(). Sashiko: https://sashiko.dev/#/patchset/20260418120233.7162-1-baohua@kernel.org