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=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 31B8CC433E1 for ; Fri, 7 Aug 2020 06:20:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D49F7221E5 for ; Fri, 7 Aug 2020 06:19:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="R8F3PuCY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D49F7221E5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 61CDD8D0034; Fri, 7 Aug 2020 02:19:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F61F8D0026; Fri, 7 Aug 2020 02:19:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 535C78D0034; Fri, 7 Aug 2020 02:19:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id 331968D0026 for ; Fri, 7 Aug 2020 02:19:59 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id F0C0582499B9 for ; Fri, 7 Aug 2020 06:19:58 +0000 (UTC) X-FDA: 77122772076.01.run76_19122ef26fbe Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 06BE110051B20 for ; Fri, 7 Aug 2020 06:19:57 +0000 (UTC) X-HE-Tag: run76_19122ef26fbe X-Filterd-Recvd-Size: 3115 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Aug 2020 06:19:56 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (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 925D122D03; Fri, 7 Aug 2020 06:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596781195; bh=2ygTrxq33L8OrQfhcyX0bwMi+QHMXvPJRyccVxwO+Yw=; h=Date:From:To:Subject:In-Reply-To:From; b=R8F3PuCYNZ4dM/XJ9J5DjA79RtMlYGlplQDmiXXNt6BR6QIM/iLzFqtnYjvMs9ABt wjb+IOWCz8zeSdopKiMydNEc+Z7mF7rfm5KT7qY4uFYlk4u0pZq/2Xs+v0d4/rr0C6 SEU7Ij8CRpvs1StWOvYEyiy4bNaNg/5HlLL+C2N8= Date: Thu, 06 Aug 2020 23:19:55 -0700 From: Andrew Morton To: akpm@linux-foundation.org, gavin.dg@linux.alibaba.com, hannes@cmpxchg.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, riel@surriel.com, shakeelb@google.com, torvalds@linux-foundation.org, yang.shi@linux.alibaba.com Subject: [patch 051/163] mm: filemap: clear idle flag for writes Message-ID: <20200807061955.ErOcFZbpk%akpm@linux-foundation.org> In-Reply-To: <20200806231643.a2711a608dd0f18bff2caf2b@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: 06BE110051B20 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: From: Yang Shi Subject: mm: filemap: clear idle flag for writes Since commit bbddabe2e436aa ("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. Link: http://lkml.kernel.org/r/1593020612-13051-1-git-send-email-yang.shi@linux.alibaba.com Fixes: bbddabe2e436 ("mm: filemap: only do access activations on reads") Signed-off-by: Yang Shi Reported-by: Gang Deng Reviewed-by: Shakeel Butt Cc: Johannes Weiner Cc: Rik van Riel Signed-off-by: Andrew Morton --- mm/filemap.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/mm/filemap.c~mm-filemap-clear-idle-flag-for-writes +++ a/mm/filemap.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "internal.h" #define CREATE_TRACE_POINTS @@ -1689,6 +1690,11 @@ repeat: 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)) { _