Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp769147ybt; Wed, 24 Jun 2020 10:44:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2RATblMwmm9IaHsd7dbWdWH1P7SVw/HsK4e4WmYGCCZb8TtAkEWe8wlX+VH6dAC9+MZnD X-Received: by 2002:a17:906:edb3:: with SMTP id sa19mr19382387ejb.21.1593020667776; Wed, 24 Jun 2020 10:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593020667; cv=none; d=google.com; s=arc-20160816; b=NX+QDLdJetL+8OWdwuTAalM6oq0wzlpW2lFr0jDlQ+Ei/efimEo2N8lYZ+YN7sAc6m 9f1lR3PkTV+H0oBVkhFFJqwLwTVSNqVyHfbbijF/npskvWkNXi3xzqrri51DqDHwqYDC TMMTgoFmRxdEnd+3p10tSeEaJsm1JB1L0d8ufr7Arj6hnhJYtD+8W50UIbhC8mjQ2z/u 9/ZdK5n1/nh5966ULdcw5MRWNqku8ZcTbpSoRpG3YZjkSNtqqDhv23h1Ncd+EkfxkFB4 M6i5nFLP5QDY9wyjZrcN1uhxief2YtxCFbfb0o8iDqGloAh1samaxKaGUzx3bQirlvX2 +/NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=UIXMW4xxsbuAz2rruRqSqVrrOVmlG6USLzEosq7rIqY=; b=mBc/RATlbf2zeMWg/3NnPsDMqB7Sx73sPifNqhN31QaY1bI3FwvJX5W5nL8n8K8Ttn zgV8HIJ9sHyMiPovw7lPk8iipNekuSZCywFm4M4pHFog/i+m5nGjfDbrz3YjPMLOzNuc FjNkB6wwx+rFCSA5+isAQon/ixmhnTUGD8gzVpp2dLbY/48s81JUcw/QTcsv3XRli7VV e0hdwEaaSiPHL6VMcF+XGdVFeWDjQXkyQvpYXpyIlIi+kDdr2pBgHdJBeBJUcNHe+pKn n23C1K9vPAsjf0B7EAhQGd3zn7RKzPfCpKztbUa+WJQYI0beelu67s+Zc/ZgEwAERKwK uY8g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qh14si13299258ejb.259.2020.06.24.10.44.03; Wed, 24 Jun 2020 10:44:27 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405603AbgFXRnp (ORCPT + 99 others); Wed, 24 Jun 2020 13:43:45 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:40125 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405567AbgFXRnp (ORCPT ); Wed, 24 Jun 2020 13:43:45 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R371e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04397;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0U0cU66h_1593020612; Received: from localhost(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0U0cU66h_1593020612) by smtp.aliyun-inc.com(127.0.0.1); Thu, 25 Jun 2020 01:43:41 +0800 From: Yang Shi To: hannes@cmpxchg.org, riel@surriel.com, shakeelb@google.com, gavin.dg@linux.alibaba.com, akpm@linux-foundation.org Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: filemap: clear idle flag for writes Date: Thu, 25 Jun 2020 01:43:32 +0800 Message-Id: <1593020612-13051-1-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Fixes: bbddabe2e436 ("mm: filemap: only do access activations on reads") Cc: Johannes Weiner Cc: Rik van Riel Cc: Shakeel Butt Reported-by: Gang Deng Signed-off-by: Yang Shi --- mm/filemap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/filemap.c b/mm/filemap.c index f0ae9a6..0589aef 100644 --- 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)) { -- 1.8.3.1