From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753879AbbJ0Kw7 (ORCPT ); Tue, 27 Oct 2015 06:52:59 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34020 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753397AbbJ0Kw4 (ORCPT ); Tue, 27 Oct 2015 06:52:56 -0400 Date: Tue, 27 Oct 2015 19:52:48 +0900 From: Tejun Heo To: Michal Hocko Cc: Christoph Lameter , Tetsuo Handa , linux-mm@kvack.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, David Rientjes , oleg@redhat.com, kwalker@redhat.com, akpm@linux-foundation.org, hannes@cmpxchg.org, vdavydov@parallels.com, skozina@redhat.com, mgorman@suse.de, riel@redhat.com Subject: Re: [PATCH] mm,vmscan: Use accurate values for zone_reclaimable() checks Message-ID: <20151027105248.GA18741@mtj.duckdns.org> References: <20151022151528.GG30579@mtj.duckdns.org> <20151022153559.GF26854@dhcp22.suse.cz> <20151022153703.GA3899@mtj.duckdns.org> <20151022154922.GG26854@dhcp22.suse.cz> <20151022184226.GA19289@mtj.duckdns.org> <20151023083316.GB2410@dhcp22.suse.cz> <20151023103630.GA4170@mtj.duckdns.org> <20151023111145.GH2410@dhcp22.suse.cz> <20151023182109.GA14610@mtj.duckdns.org> <20151027091603.GB9891@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151027091603.GB9891@dhcp22.suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Michal. On Tue, Oct 27, 2015 at 10:16:03AM +0100, Michal Hocko wrote: > > Seriously, nobody goes full-on RUNNING. > > Looping with cond_resched seems like general pattern in the kernel when > there is no clear source to wait for. We have io_schedule when we know > we should wait for IO (in case of congestion) but this is not necessarily > the case - as you can see here. What should we wait for? A short nap > without actually waiting on anything sounds like a dirty workaround to > me. It's one thing to do cond_resched() in long loops to avoid long priority inversions and another to indefinitely loop without making any difference. > > > guarantee that then I would argue that it should be implicit for > > > WQ_MEM_RECLAIM otherwise we always risk a similar situation. What would > > > be a counter argument for doing that? > > > > Not serving any actual purpose and degrading execution behavior. > > I dunno, I am not familiar with WQ internals to see the risks but to me > it sounds like WQ_MEM_RECLAIM gives an incorrect impression of safety > wrt. memory pressure and as demonstrated it doesn't do that. Even if you It generally does. This is an extremely rare corner case where infinite loop w/o forward progress is introduce w/o the user being outright buggy. > consider cond_resched behavior of the page allocator as bug we should be > able to handle this gracefully. We can argue this back and forth forever but we'll either need to special case it (be it short sleep or a special flag) or implement a rather complex detection logic which will likely involve some level of complexity and is dubious in its practical usefulness. It's a trade-off and given the circumstances adding short sleep looks like a reasonable one to me. If this is more common, we definitely wanna go for automatic detection. Thanks. -- tejun