Received: by 2002:a05:7412:d002:b0:f9:9049:d2ea with SMTP id bd2csp15671rdb; Wed, 20 Dec 2023 02:32:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSKk6lwmSg0txebFZ2Ishfg97eD2yAko7i36wT4/e0W0S7eDrV9aZSgO8P4dGmUlkfx4MG X-Received: by 2002:a17:906:f188:b0:a23:5fbd:b19b with SMTP id gs8-20020a170906f18800b00a235fbdb19bmr1946936ejb.130.1703068361994; Wed, 20 Dec 2023 02:32:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703068361; cv=none; d=google.com; s=arc-20160816; b=hmlJXURMjb7Jom3POK5wOdLFZqkoqs3J/6keuptFpVEBcpeBkMe71uWQAAgJDWJzcE 1OoGN1OMekOzzQFcDhMm+EcweM1UFlhRchfYHJoXP605vqhg7++UcfKfxnO/Wr6kvIHV UpgATfyrWzTouXaaL8OAnCHvZc0iKhoAD4cJlEHUtz9fuYZKow4n+/eRxUld1gdONHQz 4CAuAdQsiGVX//QdCoJl9oQ6J8LKY95BOFj9byhiXCmpH/9YAZ+FHxfasDwSBc4vLsTX bd2fNvmOHXWzKl4NwEAEQ3Rjt0o3gl73ZqjzzGgWc038P+VLLPWH/goU7jH44FX1pX5R 4vLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from; bh=IcMCJjSuJWg2+1zOkqHn43M0PiRi8RQRNjPEivqGzNY=; fh=5g6lE+buQy4ZOwE68BhwwYhQDuD3QGYo1sTjLX26BVI=; b=hLAUbZWDrzpIWto4YGvjMikzsUDA2G2DksiDX1HkPtw+qcBPtcKyUF4r9Zx82/5W6b RM+xlICeKDc/LJkno+eyMC7f9yFsOcP3528LKb/BVVFHjh2cl/Kc3v6ajv+N0OpORQR+ Kzw8zJtVpsoevLpUoQU7RIZ2cleBTED/09JijJL9+PQ5CZghZm52uJ47/2MuBNanmHDk HOObiukSkVIPoB/zD16unc+yYzTLp/dBt8KbdPtwSCMsnvY6BC5k+gLmOiV+9N/qietY J2AJUWKcAWzgQE1gMHeNn4IYIlemySl9OUmLdu7fvtkCkTIQTY4BOonMXTf0q7FlETSD cO7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-6746-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6746-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cf14-20020a170906b2ce00b00a268753dbb6si956781ejb.555.2023.12.20.02.32.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 02:32:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6746-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-6746-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6746-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B1E501F26AB8 for ; Wed, 20 Dec 2023 10:31:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 293B420B02; Wed, 20 Dec 2023 10:30:51 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) (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 B5B25210F5 for ; Wed, 20 Dec 2023 10:30:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 3BKATt6H069490; Wed, 20 Dec 2023 18:29:55 +0800 (+08) (envelope-from zhaoyang.huang@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4Sw8mD0818z2QJrHp; Wed, 20 Dec 2023 18:23:39 +0800 (CST) Received: from bj03382pcu01.spreadtrum.com (10.0.73.40) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 20 Dec 2023 18:29:53 +0800 From: "zhaoyang.huang" To: Andrew Morton , Matthew Wilcox , , , Zhaoyang Huang , Subject: [RFC PATCH 1/1] mm: mark folio accessed in minor fault Date: Wed, 20 Dec 2023 18:29:48 +0800 Message-ID: <20231220102948.1963798-1-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL:SHSQR01.spreadtrum.com 3BKATt6H069490 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. Signed-off-by: Zhaoyang Huang --- mm/filemap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/filemap.c b/mm/filemap.c index f0a15ce1bd1b..b1ee6ce716c2 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3273,6 +3273,11 @@ vm_fault_t filemap_fault(struct vm_fault *vmf) */ folio = filemap_get_folio(mapping, index); if (likely(!IS_ERR(folio))) { + /* + * try to promote inactive folio here when it is accessed + * as minor fault + */ + folio_mark_accessed(folio); /* * We found the page, so try async readahead before waiting for * the lock. -- 2.25.1