From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E328C433E0 for ; Wed, 24 Jun 2020 19:51:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DBCD120768 for ; Wed, 24 Jun 2020 19:51:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IQox80nq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBCD120768 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 82B6C6B0002; Wed, 24 Jun 2020 15:51:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DACB6B0008; Wed, 24 Jun 2020 15:51:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7187E6B000A; Wed, 24 Jun 2020 15:51:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id 599626B0002 for ; Wed, 24 Jun 2020 15:51:09 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2558C2DFC for ; Wed, 24 Jun 2020 19:51:09 +0000 (UTC) X-FDA: 76965149058.18.music28_0c1521326e46 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id E2511100EDBE6 for ; Wed, 24 Jun 2020 19:51:08 +0000 (UTC) X-HE-Tag: music28_0c1521326e46 X-Filterd-Recvd-Size: 5080 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 19:51:08 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id y13so1925133lfe.9 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=ghVcNglgCG8qnNWBULM/8abTz6At6/nF1Tx6CbYc5yBVhso9yUCltyalAn7yxVBAb7 NLPy0ZoyYYDrmlxBkgMzs6PSC0dwirran12YEjpxvRYujm35eV/6apDz0rrYmTeW1avU 6DDLQhVbYtY8Oc1Q4aBQ/TPlTkRMUz4L5DtVtMDe7KOYt3gi5nExkL/0EM3aWxYklt3/ W/LGkaXffSuIxY1X1DvCOh5brvxBtv2GGeL3L4yDupk0vsEa5OYab0pvCXHjV8qD7SEv 00pHVtXkecCbQjPFL7C74xoHTBcKVx7AmUuOrO83Rm1tlKscFVssoF3wz2CfXQr5gBk7 nDmA== X-Gm-Message-State: AOAM530ciQ0qF0g66WomDnkNrIV9unAdRutBLIz1IHpmYlhrdmOyCVNV 3I/YttzIGU6xV/eY4Fr4Q8b5NL5GQIOlwmmNvHi23A== X-Google-Smtp-Source: ABdhPJwN+9jJvyPQZbs5Vt0yJCm7O1mbDa7eNA87UsIDrPWLGFu8X2N2J+GCp0bygrkuHWixHoY5PExoMMWqb7rDVGc= 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" X-Rspamd-Queue-Id: E2511100EDBE6 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: 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.