Received: by 2002:a05:7412:a9a3:b0:f9:93eb:408e with SMTP id o35csp3267rdh; Wed, 20 Dec 2023 20:11:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFKSEhffJy9UzD6SLnMqXNoSKOyeXPXBPbJ595/PaDJH0lK6QmJaFgAR6mCIZAgL8bYnUPl X-Received: by 2002:a05:6808:384a:b0:3bb:6dfc:c0b0 with SMTP id ej10-20020a056808384a00b003bb6dfcc0b0mr3309118oib.37.1703131892349; Wed, 20 Dec 2023 20:11:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703131892; cv=none; d=google.com; s=arc-20160816; b=lLVRE2JHgl0ePiMpwZOU2ja7KHwU/ehnDEe2AOaWJiFAHYLAsexa1L+f+kaIcc+kfo 1s8fQuMHQxkbeVk0WhWR83z0U7C7k+4MBy4UbYEqjs7y449yYstl3dEqH5ASZCBgscve aoCwGeh6tOauWZeSmCAlPnBG8L4VbZlDIjdPDBPqO2qR/076xXCiuOuagX+g7kEoAsyq FyluYUSdV2fYgiiMZsdVpyD/VVSYDI87ajd3YwOwQ7lsfIwJLxk+FIVhMeKlenumCMbK gq+joXtrTZSFOaYA+q+0g4HDbbIvvVBzlWIre4feZnzngz+EkzjYPEtv5RAFtOnV54ea LfFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p6d3JusNTbIjN7yfIOJ3VrarRe+uq8kWXbELto6+bKU=; fh=TLld1Q412t9S/orOK3RsaoQPfD9IBBaDKbvTHow21tU=; b=y7a17Ug1lcPV30tWsVc+rN2qh7aZ39M6pABGymwlMsBVbkY0lSS+Q+iN3fODQHvbDP kpksBf9Kf6idx1vlzi5qF5FI7g7MAqB0Ki33nI6xoBJeFnSP3c6CsjbY3lAMtT5SRGQs FWCarXAobQRZj67sHoVErRPNldzKoE8FGKCErpJB3VRYwINUBZS1K3gtuoqqnjoz0RyQ G1AB3rP4mrzW4cljEYIlR2ogSU1Yz8tXtXxa+6botp/v2NfHzOcH25XVySdRVDtGzpza NPQoa8Q3i+8rNtVNacGZTcYTo+yR4JAC8xomlj5p9sgi85wPPOlQV+c6u58U9kkU4urs yDTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ae7VBn7j; spf=pass (google.com: domain of linux-kernel+bounces-7829-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7829-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id c7-20020a6566c7000000b005cd825f5dffsi847427pgw.552.2023.12.20.20.11.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 20:11:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7829-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ae7VBn7j; spf=pass (google.com: domain of linux-kernel+bounces-7829-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7829-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 019B9B23E14 for ; Thu, 21 Dec 2023 04:09:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D88998BFA; Thu, 21 Dec 2023 04:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ae7VBn7j" 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 D1CC76FBC for ; Thu, 21 Dec 2023 04:09:34 +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-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=p6d3JusNTbIjN7yfIOJ3VrarRe+uq8kWXbELto6+bKU=; b=ae7VBn7jMkc059d6wg7B4dq5V+ ghRqhxdB2VsgXmGDT17BciX/HOdKWPNmUr8MA9D1iCwa9WnpkiU+Tr+vkEqwp0xQJXjiraH0ilTmr NDiEsri/7/8seTi1E1z1E1m01RXLSpTDKBHzS5a2IYXKV5AR0vP8AWsJzsYjHiBltqBMsIWM4WOUS n8khQ8McUz6Ozv1Kd+Swr8o8p7tI05Dmn1+c/RmrJR2fQWfSgbVSBY5n8Y9jCAbZb2ImMwFO+t3in 0RhQNvghCDV/3I8B8Z7BcAS4GLmdspdPVy2YEsIFEyenkVE2VQMrl0H4A9MD1y1llLIxfX78tc/En tpMY8/9w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rGAN2-004e2w-Tg; Thu, 21 Dec 2023 04:09:16 +0000 Date: Thu, 21 Dec 2023 04:09:16 +0000 From: Matthew Wilcox To: Zhaoyang Huang Cc: "zhaoyang.huang" , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Dec 21, 2023 at 09:58:25AM +0800, Zhaoyang Huang wrote: > On Wed, Dec 20, 2023 at 10:14 PM Matthew Wilcox wrote: > > > > 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? > Thanks for heads-up, I am out of date for readahead mechanism. My goal It's not a terribly new mechanism ... filemap_map_pages() was added nine years ago in 2014 by commit f1820361f83d > is to have mapped file pages behave like other pages which could be > promoted immediately when they are accessed. I will update the patch > and provide benchmark data in new patch set. Understood. I don't know the history of this, so I'm not sure if the decision to not mark folios as accessed here was intentional or not. I suspect it's entirely unintentional. By the way, rather than inserting an explicit call to folio_set_accessed() in filemap_fault(), change the filemap_get_folio() call to __filemap_get_folio() and add FGP_ACCESSED to the fgp flags.