Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp833257ybt; Wed, 24 Jun 2020 12:20:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGJ4TII+thVmN8HpNoUtBexMXIL4U4WeHQc+/+kzSHuMme8X6MuX6kn991EikMZ1ySapPX X-Received: by 2002:a05:6402:308b:: with SMTP id de11mr28682703edb.181.1593026404782; Wed, 24 Jun 2020 12:20:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593026404; cv=none; d=google.com; s=arc-20160816; b=UvelwgrMbWgXO6Q+xyg9N9E2i2Iuf/6NM5eS+76jE8RpNGIrjUa85A1tkPJhmw2eIe ceD56Y72d57EKXxmiYLoluuuM4FTPJzOOY0LazuYVHhat6F+S9FUP3VkgbO1S56Dq6ig NwxlEqiPtazWpf1vxhZypfLgJAglmMd1gDdJOJHaHLQ/cERl0xsuo2aziC1/C7CxvY49 cn+sN7nUAoi2bllbLWDkk3Ix3T9MjUOb7YmwCsxv/1GtOcEiqqfEeNOnb+DOu00SQkMk LJ/daKlU6dfQpMjoScQ9hbh/0HVGTlTQlchtoPwDxkb7JhEQXuuselsDEdmW95vOxt1t qLDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=3YONrnq1Z2qW5xUjNyX87i+Xpz9WVB0kdsXAgbfx7+Q=; b=yOxBgksRrSMU7FPXyzqnh66wZBcqCP5XIx2a6luwczkgug7Z0BqxbkEfOYjBETdUjP FR4Q3dgnCFtoI3HLCJu3CaxjngOv7FTyoQS5+TnKqK3vsk8YCjS3RIpLsqHLc78W4py2 NBWGGjby2jASEVykhigM8EKVTU/847WBn8xbE2/Cc+Ub92+Slsev0SKWjdLB8t3vdWze xRUc4vAgY7iAFFzbw5mVP3sGlhcWLKw0Bcg9kFj7I9zRoYlE7/scRQYubdkks2IhhkyR cHcUm5i48Nl7x0ZHdAemPYdZnHBovG8tVKjM9uf7u4sgCrPw8aJ5fOdFg51AWzI+TdDH 0v9w== 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 b2si13294399ejk.469.2020.06.24.12.19.41; Wed, 24 Jun 2020 12:20:04 -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 S2406082AbgFXTSL (ORCPT + 99 others); Wed, 24 Jun 2020 15:18:11 -0400 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:55626 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404563AbgFXTSK (ORCPT ); Wed, 24 Jun 2020 15:18:10 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R621e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07425;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0U0cnbjv_1593026284; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0U0cnbjv_1593026284) by smtp.aliyun-inc.com(127.0.0.1); Thu, 25 Jun 2020 03:18:06 +0800 Subject: Re: [PATCH] mm: filemap: clear idle flag for writes To: Andrew Morton Cc: hannes@cmpxchg.org, riel@surriel.com, shakeelb@google.com, gavin.dg@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1593020612-13051-1-git-send-email-yang.shi@linux.alibaba.com> <20200624115317.792d8fc6369d421d2898ab2f@linux-foundation.org> From: Yang Shi Message-ID: Date: Wed, 24 Jun 2020 12:18:02 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20200624115317.792d8fc6369d421d2898ab2f@linux-foundation.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.