From patchwork Wed Jun 24 17:43:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 11623865 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B33F1392 for ; Wed, 24 Jun 2020 17:43:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AB58B2078E for ; Wed, 24 Jun 2020 17:43:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB58B2078E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A57156B000A; Wed, 24 Jun 2020 13:43:49 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A06E86B000C; Wed, 24 Jun 2020 13:43:49 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91D1D6B000D; Wed, 24 Jun 2020 13:43:49 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0128.hostedemail.com [216.40.44.128]) by kanga.kvack.org (Postfix) with ESMTP id 7A9F66B000A for ; Wed, 24 Jun 2020 13:43:49 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2E9AE181AC9CB for ; Wed, 24 Jun 2020 17:43:49 +0000 (UTC) X-FDA: 76964828178.11.pigs24_331479626e46 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 01413180F8B80 for ; Wed, 24 Jun 2020 17:43:48 +0000 (UTC) X-Spam-Summary: 1,0,0,df2309e8496cc9b5,d41d8cd98f00b204,yang.shi@linux.alibaba.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1345:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2690:2901:2918:3138:3139:3140:3141:3142:3352:3865:3866:3867:3871:3872:5007:6261:7903:8603:10004:10226:11026:11473:11658:11914:12043:12048:12296:12297:12438:12555:12679:12895:13069:13161:13221:13229:13311:13357:14093:14096:14181:14384:14394:14721:21060:21067:21080:21451:21627:21740:30054,0,RBL:115.124.30.45:@linux.alibaba.com:.lbl8.mailshell.net-62.20.2.100 64.201.201.201;04yrzai3nd79co379mo66bfknspxfopzu189k59bqdcppxxue3if7iwq5ttwrkx.xyeotbawj3xkp7cxoir49hchfjo18jh514omnzc8u4op6187zninwfxcgupqypq.6-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: pigs24_331479626e46 X-Filterd-Recvd-Size: 2653 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 17:43:47 +0000 (UTC) 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 X-Rspamd-Queue-Id: 01413180F8B80 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000012, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Shakeel Butt --- 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)) {