Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp55204rdb; Wed, 20 Dec 2023 06:14:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEivCUGBaVquNFUqz/8qGkecphYquQepNcs0vgMwqTRHqpxrC42SNpU0o+HOr1/8Yt7r/8J X-Received: by 2002:ac8:5891:0:b0:425:4043:29e0 with SMTP id t17-20020ac85891000000b00425404329e0mr26143982qta.91.1703081670631; Wed, 20 Dec 2023 06:14:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703081670; cv=none; d=google.com; s=arc-20160816; b=cpJ0uXtKl3wfpXF4QUWC6UaQICE7lXElmY73f1QeE2B09pdIYD8e5IqDvGbJcgtiew yhLrlieWQaw+YVzBqIhLkeUY1W0RcMDW1z31qGRR68eGo/YAg4TgFIMOSYGqybONGVEg T/KaeC02lOrZSlZVcxSvQ55ltyN5lFMXfeizCyT60BFAK+75+Re8FgUDjf0RzuvFo7dI C2kBFO36iishEM8pCU9SfaPJM2fue8oJV3YeGEIPQcZz5FRPWEtxf1ZW0yJtZCM3oWpy 92lg+0jx3pErIu3hIdKfr/QZpxjyLePjYvJBhLlsZK4LkU9PRc7kRmWZAeU85sLijsJ9 CO+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=upMoMYmYXslt+fyn4QzQsj8lri95H6D9tWlWB4yk1Ho=; fh=cDRe+Le/GiTIw3gUU3zxIS0+S/D9b8Efj3qHkKW6jdo=; b=jZayGiX6pO18AKxE1C01QM5LymS+nE0jpvT/EA0n0mWMyd4ymEJZVxv8v1Moku5SKA P9hnin+5dXRFYZKwHeznlKd9lB8oPb5/lhCqpyEqxBH9D7w9NEH4++mwXb1jxPOXof4P vWaamz+5KKUuRuJwlvavK13V2ac9jv/FbBwvxBS/BUUv3/NO3Kt4i2JcHIKWgw6dO1Ot uTgedfC0CVLXT2w1+5gL4/oNdYj9AkwVcJ4AVaLOwDKQZ8msb23vOLu1rNcYojMR3QTF zgFSBlfcR1upV2n8ctV2PBLZUqvAs4Y25OOzWYR0NMUmga4bdyUahO15yOALS0t9eN72 H/gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=mJ9Y1aBn; spf=pass (google.com: domain of linux-kernel+bounces-7042-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7042-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g6-20020ac87d06000000b0042543ac282esi323800qtb.705.2023.12.20.06.14.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:14:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7042-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=mJ9Y1aBn; spf=pass (google.com: domain of linux-kernel+bounces-7042-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7042-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 638AA1C20B3A for ; Wed, 20 Dec 2023 14:14:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7981838DEA; Wed, 20 Dec 2023 14:14:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="mJ9Y1aBn" X-Original-To: linux-kernel@vger.kernel.org Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 CF6B038DD6 for ; Wed, 20 Dec 2023 14:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=upMoMYmYXslt+fyn4QzQsj8lri95H6D9tWlWB4yk1Ho=; b=mJ9Y1aBn9JmLEwVITeAsKLqvZ8 LOj/Pu6+e6LgY7pOSiNh6skuRG1mnu6M57KfmQzUNbnSmiBm0nv+IjgXQZ6J1/pnZmzaAlcpZEBd7 guriGYZT7ul2C/LcmDUYmeXMumGb0q3apjBlMuU3PDUJy4m4zXmDZu2IhWyVYIWHerAWjEG53Qrc8 sZToRI0FvIeYyOUoahnpVQ86dRVyg4/8vPOZtNNSeCpVm+WpnXt8wcxV/nZNmDMC5pn6sDZYZqTqo Fu4xdDrPU29rlnLfpfnL456hHDEe19fKK3qcpgzrowbzkeh29uRUklcblF+mIYLCTqIRSRP+YvUDW eozqVYgQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rFxKn-00436p-2d; Wed, 20 Dec 2023 14:14:05 +0000 Date: Wed, 20 Dec 2023 14:14:05 +0000 From: Matthew Wilcox To: "zhaoyang.huang" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com Subject: Re: [RFC PATCH 1/1] mm: mark folio accessed in minor fault Message-ID: References: <20231220102948.1963798-1-zhaoyang.huang@unisoc.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: <20231220102948.1963798-1-zhaoyang.huang@unisoc.com> On Wed, Dec 20, 2023 at 06:29:48PM +0800, zhaoyang.huang wrote: > From: Zhaoyang Huang > > Inactive mapped folio will be promoted to active only when it is > scanned in shrink_inactive_list, while the vfs folio will do this > immidiatly when it is accessed. These will introduce two affections: > > 1. NR_ACTIVE_FILE is not accurate as expected. > 2. Low reclaiming efficiency caused by dummy nactive folio which should > be kept as earlier as shrink_active_list. > > I would like to suggest mark the folio be accessed in minor fault to > solve this situation. This isn't going to be as effective as you imagine. Almost all file faults are handled through filemap_map_pages(). So I must ask, what testing have you done with this patch? And while you're gathering data, what effect would this patch have on your workloads? diff --git a/mm/filemap.c b/mm/filemap.c index 2e6b1daac6cd..8cecf82dcc5a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3418,6 +3418,7 @@ static struct folio *next_uptodate_folio(struct xa_state *xas, max_idx = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE); if (xas->xa_index >= max_idx) goto unlock; + folio_mark_accessed(folio); return folio; unlock: folio_unlock(folio);