From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 8922E33F5A6 for ; Fri, 24 Apr 2026 17:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777050211; cv=none; b=YYy8g+yrL9AX2DZW4UYuY6gk5ghUMLKgYBZQQHFtl54g8Gz6Nh6vLo/OTL8nxaR5vZkQn3zJpSTsDJMxJ2q7qnrLkxLOm4braWD4jBjjXdtrT2yrG9zeagTJz9Z0q9ZB1kyPPEcxY2ZTv0Vx7l2QTEhbIJMIMEqfM7svQaqd3/M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777050211; c=relaxed/simple; bh=EhEj+pIMMIiy6AP8/9L6OxYP7Mz81P4negIS1EvwsWk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n2egOZ17u9S678sKKh6bytKMvAZ3KHS8ofFO+yjlPiUNplB5jGr/DOAVZBzaQ2qxHeyFpQJVU7wAjMQXgqh1KGKixe3Nn2GKKDqNFopY39ZUJkn3k//UoQrL7jAspVqcB0vPzR0oUm0d7q0Hafy9wLu0F0uWKXHYaTTpmacknjc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=o9BWKgOp; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="o9BWKgOp" Date: Fri, 24 Apr 2026 10:03:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1777050205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3PxzC51aQA2fUyDAJ+7W52bxyjfPnIe8XaOR5KMc8c0=; b=o9BWKgOpkE3OcHqpWEJO+vDuUJZo4r+JopDCV5ZJ2apzJXaFmJlJMcz9cEU44UFD3tq3zv 5RvcqDTYpdNHMj/q3tp2S8GoRGELDhl/5We5EP0T5kO84ms4J8mG7LWD1Nh5o+M9Io12mE bhLgBNx0okXVC7P2Ct6etfY46miyvWc= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: "Barry Song (Xiaomi)" Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Lance Yang , Xueyuan Chen , Kairui Song , Qi Zheng , 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: References: <20260418120233.7162-1-baohua@kernel.org> 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: <20260418120233.7162-1-baohua@kernel.org> X-Migadu-Flow: FLOW_OUT On Sat, Apr 18, 2026 at 08:02:33PM +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(). > There is a following comment and stat update in lru_gen_refault() which is referring to setting active bit which this patch is removing. /* see folio_add_lru() where folio_set_active() will be called */ if (lru_gen_in_fault()) mod_lruvec_state(lruvec, WORKINGSET_ACTIVATE_BASE + type, delta); Is this still relevant or need changes? I have not yet dig deeper into the patch and the heuristic. Will do later.