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: 13499884 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66B92C3DA6E for ; Wed, 20 Dec 2023 10:30:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 053646B0075; Wed, 20 Dec 2023 05:30:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 002906B0078; Wed, 20 Dec 2023 05:30:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E32E86B007D; Wed, 20 Dec 2023 05:30:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D058D6B0075 for ; Wed, 20 Dec 2023 05:30:40 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 999AC16095D for ; Wed, 20 Dec 2023 10:30:40 +0000 (UTC) X-FDA: 81586827840.23.C96ED95 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by imf02.hostedemail.com (Postfix) with ESMTP id 543FC80010 for ; Wed, 20 Dec 2023 10:30:36 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf02.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703068238; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=IcMCJjSuJWg2+1zOkqHn43M0PiRi8RQRNjPEivqGzNY=; b=xPmh31jeqDgD+zovbHvPTPCtIjmscYEYvLsk0tSOJjvxW+EsxboihFaPf8gMA+61l4U65p vfoOrjAECVuWm3dPX3TQEOBLvItksniKiqX1At3bAot243G7+NOi1Ntm7banIohPUUHcl5 +EnWXAvNfPuKlxSRfr7IkordY6FCPUM= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf02.hostedemail.com: domain of zhaoyang.huang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=zhaoyang.huang@unisoc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703068238; a=rsa-sha256; cv=none; b=LtK5+ayBiRGpZ078VADT/8q3AG6U8gjxnnx9+zlC3SRmvSFlqrVeDKpX23hx31cbl3ziWo /1oFsYYAgmnBjtIAZqR1ucPRlJokulofHJYbPvE2Em+SakhB3/bUpEY6GQAUAQ8UEztUf7 yQ0Kh3K0R4VTxXZnsrIUFZ93WJjm9E8= 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 MIME-Version: 1.0 X-Originating-IP: [10.0.73.40] X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 3BKATt6H069490 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 543FC80010 X-Stat-Signature: qawmyfpg8gdoagftw6qcnszzb96wqoco X-HE-Tag: 1703068236-734935 X-HE-Meta: U2FsdGVkX186VB7cTtypkDpgQDFAnERFRiBf0vgIUyM5eHjN2dqYzO1vmuUtIuuBOcLLd7BfI2jKfrssqpRRAu+c4GZC4u/1K6iwXphbbqiqdQ6zzSLKL0Wes5QmcTJDFRqwPbCx7S9dbcAO05HuTuYYjfIqI/JSI5YkFNnrdQHZmOk/3NVzNYk9q5gpRpOm5jVEuUQT8BBNuaZuYE6PPtCrMgODirPlIiEzDcpMXYJMNLXPed9FhgWfWVdJD4V42c23UfkpiOWiWwb01WkVdt4PCRD645MSciM70lyRkuqI/sUIPnBd0h7S2sSAM7Z4LJERe0uoW7gKgizZi/4hKUmOzH3KaTZQxVZAJBEJUIUzmRpoYWHMqlAR82ajcae/BT4lTlmYCKn83W6wFCFlL6OaACAzGHKHkVu7FntmdLvyWD3N+x2ViPITwYYEjRoye94BPBC6Pp7mG3je5lA+lawwVlpl/f+Wua7qHGre/CGbn1zQj6eOX76Yr8M4TyJGN5jUdn7DPQZ6hFVbvr/OYw4oPTI6NF/Ayxymhhq5qyq41+kYqHxxTxnAfx6sPVdgwjrRuIntC6gdsLSJp7Qc7K0Izl4qR/QbcIiqaQrzTHik4uKIIAzBk/chPHqmSCGpgSP7vKyaPTi9mWVI9OQKfJ5dU08Qqr3WXCFCfcEP5D1oKy7EgoE8sdGkS/DKOjXzgsj35P4JpgP7QgAvVHQHvmhlG9Dz09r/GWmSgobBWpylt3RDF+mSc9cQMQBSGZU0fLeHVv/FBAE/Eof/vZR91yLJplHte4vRg+M5APqRzcr0m/cF9haUZeXuhb2b+fRddRzyaurz3fUxDdsSzRLC9XfinGWpox0bcwKxYnpyyO+adZw8XF48zHm3iO9bCm+iRu0ym/WHRvH3aqtBnxxR+6WQVYuq1OsYSR5AcFHiuEzuEacemNdrBm805HRonP/kBKBvN/ttj+3O542jJ+W N7ZtZbFJ IffsYyvlNT3VcDIWlDZQ9AV7VfVlxjiDKgj2qD3tYMgBUEIA7EcRbXKaDKue3LSZOudYMTjAZIO3VxrR9X97l47Trih4TNNH6oyGZXmM9AnT0CwE7jK9llNJ16j7eLsgCKIKDGeTBEY9Fn3gZQ7msZrWecrgU3JyfczT6oOKFl9VRq8wrrQDaimideu8z7R27++o5 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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.