Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751907AbdCPKAI (ORCPT ); Thu, 16 Mar 2017 06:00:08 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:4416 "EHLO dggrg03-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751818AbdCPKAG (ORCPT ); Thu, 16 Mar 2017 06:00:06 -0400 Subject: Re: [PATCH v4] mm/vmscan: more restrictive condition for retry in do_try_to_free_pages To: Michal Hocko References: <1489577808-19228-1-git-send-email-xieyisheng1@huawei.com> <20170315124117.GH32620@dhcp22.suse.cz> CC: , , , , , , , , , From: Yisheng Xie Message-ID: <80844f35-0864-81fb-e9a1-45def1e67f8b@huawei.com> Date: Thu, 16 Mar 2017 17:59:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20170315124117.GH32620@dhcp22.suse.cz> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.40] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A010206.58CA6212.01CC,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 63e48cd433b5bc5f619311cbeaeb2aa9 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1669 Lines: 39 Hi Michal Thanks for reviewing. On 2017/3/15 20:41, Michal Hocko wrote: > On Wed 15-03-17 19:36:48, Yisheng Xie wrote: >> By reviewing code, I find that when enter do_try_to_free_pages, the >> may_thrash is always clear, and it will retry shrink zones to tap >> cgroup's reserves memory by setting may_thrash when the former >> shrink_zones reclaim nothing. >> >> However, when memcg is disabled or on legacy hierarchy, or there do not >> have any memcg protected by low limit, it should not do this useless retry >> at all, for we do not have any cgroup's reserves memory to tap, and we >> have already done hard work but made no progress. >> >> To avoid this unneeded retrying, add a new field in scan_control named >> memcg_low_protection, set it if there is any memcg protected by low limit >> and only do the retry when memcg_low_protection is set while may_thrash >> is clear. > > You still haven't explained why a retry is bad thing. It certainly is > not about performance because not a single page being reclaimed means > that all the performance went to hell already. Please always make it > clear why the change is needed/desirable. So sorry for about that! This patch is just based on code reviewing, and sure is nothing to do with performance, therefore, I also cannot get any data about it. IMO, it may save some cycles for reclaim and this make me try to prepare this patch. Just as what you said that "the current additional round of reclaim is just lame for we are trying hard to control the retry logic from the page allocator". Thanks Yisheng Xie. > > But I agree that this makes the code easier to understand so I am OK > with this change. >