Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752847AbdCPU07 (ORCPT ); Thu, 16 Mar 2017 16:26:59 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:35592 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752178AbdCPU06 (ORCPT ); Thu, 16 Mar 2017 16:26:58 -0400 MIME-Version: 1.0 In-Reply-To: <20170316195731.GA31479@cmpxchg.org> References: <1489240264-3290-1-git-send-email-ysxie@foxmail.com> <20170316195731.GA31479@cmpxchg.org> From: Shakeel Butt Date: Thu, 16 Mar 2017 13:26:56 -0700 Message-ID: Subject: Re: [PATCH v2 RFC] mm/vmscan: more restrictive condition for retry in do_try_to_free_pages To: Johannes Weiner Cc: Yisheng Xie , Andrew Morton , Mel Gorman , Vlastimil Babka , Michal Hocko , riel@redhat.com, Linux MM , LKML , xieyisheng1@huawei.com, guohanjun@huawei.com, Xishi Qiu Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1519 Lines: 33 On Thu, Mar 16, 2017 at 12:57 PM, Johannes Weiner wrote: > On Sat, Mar 11, 2017 at 09:52:15AM -0800, Shakeel Butt wrote: >> On Sat, Mar 11, 2017 at 5:51 AM, Yisheng Xie wrote: >> > @@ -2808,7 +2826,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, >> > return 1; >> > >> > /* Untapped cgroup reserves? Don't OOM, retry. */ >> > - if (!sc->may_thrash) { >> > + if (!may_thrash(sc)) { >> >> Thanks Yisheng. The name of the function may_thrash() is confusing in >> the sense that it is returning exactly the opposite of what its name >> implies. How about reversing the condition of may_thrash() function >> and change the scan_control's field may_thrash to thrashed? > > How so? > > The user sets memory.low to a minimum below which the application will > thrash. Hence, being allowed to break that minimum and causing the app > to thrash, means you "may thrash". > Basically how I interpreted may_thrash() is "may I thrash" or may I reclaim memory from memcgs which were already below memory.low. So, if it returns true, we go for second pass with the authorization to reclaim memory even from memcgs with usage below memory.low. > OTOH, I'm not sure what "thrashed" would mean. By 'thrashed', I wanted to say, hey I have already tried to reclaim memory from memcgs below their memory.low, so no need to try again but Yisheng correctly pointed out that it will cause confusion in shrink_node(). Sorry for confusion.