Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp852672ybt; Wed, 24 Jun 2020 12:54:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7oyEv3/MfjLi8VhTnkqWIOpHGSCUzurzBkREYGRRX+9SEJJ3gw+d4axbQeMgp+0VBP9Y4 X-Received: by 2002:aa7:de05:: with SMTP id h5mr17709599edv.275.1593028450189; Wed, 24 Jun 2020 12:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593028450; cv=none; d=google.com; s=arc-20160816; b=JQWyMJu9tqRUk+OTDRp64ohXx86fEtfywSJ5cr4NLALgsl5jwqhxqcAyu4TWhf+A9V ljwXJpD0Ndk9ctbk1pTrxKQWmTclPwGM7DwYI3vJrZlSfPDtDugebuyPcm66tw+QTP8c UjaMf7iGqldLcD9Zrx18VojU1Bgj7y30lyUwkmclmpdqRBK7OOMDGy18XUylW6xsaRqG ig0hVelhfc8f3XfceqCy/sx6VfPX/UQyIWOgdWhyDpMzedT/JtZdytESJP8g5sJtuziT HUCFHPg3ehFiQvFv6jInaQAHzLomUcLTMxWobeT/bxBc/dt3Lv0N1uRiUBfGx6AeP7bo /0Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=J73i3rz/I64LqKUej6oP6f1NYtvUf3NYSVwbC7dTX5w=; b=nkg4SBld9VSa5wBzPyXk/sxzdFQSYcKpmHkLl4vU/8aWX9E+XjXcObx8B0z+fKJ7Ze 9tATJdfQL5IRZyeeOS+cV1+ZYUzRCzMqkSar7ADTs4qZvpxdv/PGmtcbxfPzaEk0GTNI t+4/y0TbM+4yi/Jd39TZBmqzXBeuFveYHTgI15YamAeizRFWBsvPO9haM72pKZ9pCtfD sOckuAHFFHay2BmquOD+XMbbM/BiIQFQUF7yJ94/6d8ZfGVVf0Ag0KOgcuBoujsq+wKA riNP76K+il9jzCZdQ9wcNYfWmBoT5qMdIjw9GHL6XeD+GU8Ygb49Im3ufHVkNN1doSk0 lu5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IQox80nq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e23si1657568edq.600.2020.06.24.12.53.47; Wed, 24 Jun 2020 12:54:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IQox80nq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406237AbgFXTvJ (ORCPT + 99 others); Wed, 24 Jun 2020 15:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406233AbgFXTvJ (ORCPT ); Wed, 24 Jun 2020 15:51:09 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE685C061573 for ; Wed, 24 Jun 2020 12:51:08 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id m26so1907695lfo.13 for ; Wed, 24 Jun 2020 12:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=J73i3rz/I64LqKUej6oP6f1NYtvUf3NYSVwbC7dTX5w=; b=IQox80nqkvYl2V203YIzkDNaBu47Vj2YXveFlws6lJoadByZi6gvf5Ak74zL+CwinF gejQxBplLk+uJcb4s/uPTi4HYS+WpgF/OGhmUup1auCMtHdoP9zp9hexdeW26j0wc19+ edg+/lK8Vf6l1KTLPZ0aBQ6jnUM9BREFEDitSxhLaBrxGYlxL5coDuLDm4AEbdE+siqF 7Yp5c7NLPBs/orjJ0yiP3jy/O5ic6EW6S0FIT3vU3JIV4QqayWnwCZUSrd6QDX8UrAti cjV4OYYz/Zb3mK1GhFCbUxbSswm0Xo88qV9d7USbMn8jTNFSiWjV/m6ccO7XPPvObEEo XlMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=J73i3rz/I64LqKUej6oP6f1NYtvUf3NYSVwbC7dTX5w=; b=qqTcm6j2mhTJxungMlvl4ICc6KAR63AYR4ggVpVTjWpjzS3WEArpslmpBiN7uh0FnX o+TG3HQXy7adfcbqUddlTK7K8nXKtz1If+sP5ycXGf6prNGN8NTn3E0IuN2gmo1rfJiD aX4tCxRSQEcvUqy3t0Kf/Fff2RE7YbMpMDK2GSz6KFYpHYTfNfCYY763ETPeMJXf2zBl 112DFzyAJoBDGVUsNhe0DG8p8RDfqgiGr0TW3d3ZmQmDybkK68CS+4rq2vzLQI2du/0s sjh3/PG/E/aW43uWdeYa0INUrb/pRmOY3diM/n/XReXAnNNVjM1Bw2lE65aXIZp46yPc Nx5g== X-Gm-Message-State: AOAM532ydFjuoEMFyhdXfcafrhiGM6a9fYuHQ1R9FH/Dz4nDY8GEmIWl d1PEK2W5CZAjyoqnbWJsGF90VLKObr+6rLIaI2HCUw== X-Received: by 2002:ac2:4557:: with SMTP id j23mr10988476lfm.124.1593028266755; Wed, 24 Jun 2020 12:51:06 -0700 (PDT) MIME-Version: 1.0 References: <1593020612-13051-1-git-send-email-yang.shi@linux.alibaba.com> <20200624115317.792d8fc6369d421d2898ab2f@linux-foundation.org> In-Reply-To: From: Shakeel Butt Date: Wed, 24 Jun 2020 12:50:55 -0700 Message-ID: Subject: Re: [PATCH] mm: filemap: clear idle flag for writes To: Yang Shi Cc: Andrew Morton , Johannes Weiner , Rik van Riel , gavin.dg@linux.alibaba.com, Linux MM , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 12:18 PM Yang Shi wrote: > > > > On 6/24/20 11:53 AM, Andrew Morton wrote: > > On Thu, 25 Jun 2020 01:43:32 +0800 Yang Shi wrote: > > > >> Since commit bbddabe2e436aa7869b3ac5248df5c14ddde0cbf ("mm: filemap: > >> only do access activations on reads"), mark_page_accessed() is called > >> for reads only. But the idle flag is cleared by mark_page_accessed() so > >> the idle flag won't get cleared if the page is write accessed only. > >> > >> Basically idle page tracking is used to estimate workingset size of > >> workload, noticeable size of workingset might be missed if the idle flag > >> is not maintained correctly. > >> > >> It seems good enough to just clear idle flag for write operations. > >> > >> ... > >> > >> --- a/mm/filemap.c > >> +++ b/mm/filemap.c > >> @@ -41,6 +41,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> #include "internal.h" > >> > >> #define CREATE_TRACE_POINTS > >> @@ -1630,6 +1631,11 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index, > >> > >> if (fgp_flags & FGP_ACCESSED) > >> mark_page_accessed(page); > >> + else if (fgp_flags & FGP_WRITE) { > >> + /* Clear idle flag for buffer write */ > >> + if (page_is_idle(page)) > >> + clear_page_idle(page); > >> + } > >> > >> no_page: > >> if (!page && (fgp_flags & FGP_CREAT)) { > > The kerneldoc comment for pagecache_get_page() could do with some > > updating - it fails to mention FGP_WRITE, FGP_NOFS and FGP_NOWAIT. > > Yes, will propose a separate patch later on. > > > > > This change seems correct but also will have runtime effects. What are > > they? > > Other than a couple of extra cycles when idle page tracking is enabled, > I didn't think of other effects. It should be negligible. The idle flag > doesn't play a role in page reclaim algorithm, so it won't have impact > on that. > > The only user visible impact will be on idle page tracking users. They will get more accurate data.