Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp815494ybt; Wed, 24 Jun 2020 11:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy1yOFZ566V3lZaePWUVhW4Ru40xa70GjWbqXSBLHiz2ztQScU8C8YsvrKmaV898fhfW95 X-Received: by 2002:a17:906:848b:: with SMTP id m11mr10418049ejx.10.1593024849463; Wed, 24 Jun 2020 11:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593024849; cv=none; d=google.com; s=arc-20160816; b=aVr4+6G0bKJZYVzhQKA+qGQvaF/H4RjF0iwYmQGoWhlm2kXATnb2F4KyLn6Cfe73mB jde6xowMG4AijT/mglY+dcUUy8XNStylRqdFLm5AmeDZcQzVoN+aIPkViomcy+C5kStK OF49T/Gdfy3C3HhnqIJjvHc4odYVHir53Bt6YIanR2M3QmpXyW8a+hVU5eTGI2IszZlW b6PbO0YLcedFvZZzCZw5GOVzjrCCJtLiKd2KNVWv+BQI5s5yPVoTBFO02hBeFCOr1hDE H9EoY7iDw3+LIdzpWOAIvma9wgtvuDq6q2//q0EfbkKjvme2PCk+i5KXDKcku/gIat6/ +g0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=J4YwVApAtOxDdB9lPxhnACYYL8t62RRCxrqS7Ql8gXQ=; b=AWK8emVoCGAfeonH2sMhGPK7fDjNDi8NSOwe0tFJZwm8jvG+ct/5A8Mm1XYTdK+Jn6 HxeIgZa2RjrfaBJvuiqn8BsBV++Cmu2+sF/c5KTsmFQn/Ccm1ZDPi9OEyq68tEVUuDaw sblb88fliFXAL14geDYTcTYDnQsxxQ+RY3n3WK18tJuIbxiaUhJxc0+B/FMd80gnrdca +JbHnZ3OZrcpic05eAO5ql+WyM8JMvQs5DOQAiF/obK3KRXSRm0/VpFcVwrx7u2SkGyE YnynFypTAWD7UwsJzfe2xLXssC3ExU88s5DUUwl6xTp4OeU0WD1Uy91TXYko50Tnr7Hv NJJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HlnPOjet; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c3si14623557edl.102.2020.06.24.11.53.45; Wed, 24 Jun 2020 11:54:09 -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=@kernel.org header.s=default header.b=HlnPOjet; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406170AbgFXSxX (ORCPT + 99 others); Wed, 24 Jun 2020 14:53:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:50124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406139AbgFXSxT (ORCPT ); Wed, 24 Jun 2020 14:53:19 -0400 Received: from X1 (nat-ab2241.sltdut.senawave.net [162.218.216.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 22FA520823; Wed, 24 Jun 2020 18:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593024798; bh=HKslfhNl7tpZaCgmctNjhn1V/l+XNf4uwEwavirR290=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HlnPOjetBcFqHdrq8LMZASzOmK8BPv6UmpdDbgMfkmZtg+ksWMcnQ5XEcWc7fnBRG bt/Qk+sTWwmhAjgam/0aNcgNVhbN7y2g8QIUyqCK2AHUu/Xel7zJ5oPEexSEc/9hpY WbHIcirhJNSFY2E02EGTcBZl2CyWIC39PCD6y3f0= Date: Wed, 24 Jun 2020 11:53:17 -0700 From: Andrew Morton To: Yang Shi Cc: hannes@cmpxchg.org, riel@surriel.com, shakeelb@google.com, gavin.dg@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: filemap: clear idle flag for writes Message-Id: <20200624115317.792d8fc6369d421d2898ab2f@linux-foundation.org> In-Reply-To: <1593020612-13051-1-git-send-email-yang.shi@linux.alibaba.com> References: <1593020612-13051-1-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. This change seems correct but also will have runtime effects. What are they?