From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758563AbcFAO6n (ORCPT ); Wed, 1 Jun 2016 10:58:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:34681 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753077AbcFAO6m (ORCPT ); Wed, 1 Jun 2016 10:58:42 -0400 Subject: Re: [PATCH v2 03/18] mm, page_alloc: don't retry initial attempt in slowpath To: Michal Hocko References: <20160531130818.28724-1-vbabka@suse.cz> <20160531130818.28724-4-vbabka@suse.cz> <20160601132643.GP26601@dhcp22.suse.cz> Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mel Gorman , Joonsoo Kim , David Rientjes , Rik van Riel From: Vlastimil Babka Message-ID: <574EF81E.6030402@suse.cz> Date: Wed, 1 Jun 2016 16:58:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <20160601132643.GP26601@dhcp22.suse.cz> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/01/2016 03:26 PM, Michal Hocko wrote: > On Tue 31-05-16 15:08:03, Vlastimil Babka wrote: > [...] >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >> index da3a62a94b4a..9f83259a18a8 100644 >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@ -3367,10 +3367,9 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, >> bool drained = false; >> >> *did_some_progress = __perform_reclaim(gfp_mask, order, ac); >> - if (unlikely(!(*did_some_progress))) >> - return NULL; >> >> retry: >> + /* We attempt even when no progress, as kswapd might have done some */ >> page = get_page_from_freelist(gfp_mask, order, alloc_flags, ac); > > Is this really likely to happen, though? Sure we might have last few > reclaimable pages on the LRU lists but I am not sure this would make a > large difference then. > > That being said, I do not think this is harmful but I find it a bit > weird to invoke a reclaim and then ignore the feedback... Will leave the > decision up to you but the original patch seemed neater. OK, I'll think about it. >> >> /* >> @@ -3378,7 +3377,7 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order, >> * pages are pinned on the per-cpu lists or in high alloc reserves. >> * Shrink them them and try again >> */ >> - if (!page && !drained) { >> + if (!page && *did_some_progress && !drained) { >> unreserve_highatomic_pageblock(ac); >> drain_all_pages(NULL); >> drained = true; > > I do not remember this in the previous version. Because it's consequence of the new hunk above. > Why shouldn't we > unreserve highatomic reserves when there was no progress? Previously the "return NULL" for no progress would also skip this. So I wanted to change just the get_page_from_freelist() part. IIUC the reasoning here is that if there was reclaim progress but we didn't succeed getting the page, it can mean it's stuck on per-cpu or reserve. If there was no progress, it's unlikely that anything is stuck there.