From patchwork Wed Dec 20 10:29:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 181605 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2544203dyi; Wed, 20 Dec 2023 02:32:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFd5Nf5wXfKZP1LjBkTD5RGjfCKPlkU6t89rnKxU9pP2a1po4ZNm1XP+SWQHQwpFqBd4Bp X-Received: by 2002:a17:906:d41:b0:a23:73db:391a with SMTP id r1-20020a1709060d4100b00a2373db391amr1096651ejh.149.1703068366540; Wed, 20 Dec 2023 02:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703068366; cv=none; d=google.com; s=arc-20160816; b=EMpiQ8MbaYGPBpDpMGLh8udxC6naof8SLfvPveYoWslulHpyC5OjfF3+dznLNsq5s2 mVcQeU3PVzJlIeBWuZ0rdgYQzUWEh2Ip0Pd5V/Ql2r7KUbez432B1ZX0zG/MTTGVv0KM WCVeomZsECwHPfkqi7x5EVqba2adSFPl9k6oLBc+tmVVR//qveXuEFb25BlqBspLwI3P BEb8qe6Q3m7iqnO2zK8EM+ZViJgBrRsxzBWoQqM9Ky2+U7cEsC7ooLs18ldlT9dffnFm qgtHHlVIg69KhCxykJYFtaVgA7kz9551rIkpVLCRioI1OUYPy5isEo5IWfEyL5bowrNM pLtQ== 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6746-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s22-20020a170906bc5600b00a2363129eb5si2267537ejv.403.2023.12.20.02.32.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 02:32:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6746-ouuuleilei=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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6746-ouuuleilei=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 8FF7B1F26D71 for ; Wed, 20 Dec 2023 10:31:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 270F921341; Wed, 20 Dec 2023 10:30:52 +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 X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 3BKATt6H069490 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785796615477815679 X-GMAIL-MSGID: 1785796615477815679 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.