From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752805AbbKLMje (ORCPT ); Thu, 12 Nov 2015 07:39:34 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:33063 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752056AbbKLMjb (ORCPT ); Thu, 12 Nov 2015 07:39:31 -0500 Date: Thu, 12 Nov 2015 13:39:28 +0100 From: Michal Hocko To: linux-mm@kvack.org Cc: Andrew Morton , Linus Torvalds , Mel Gorman , Johannes Weiner , Rik van Riel , David Rientjes , Tetsuo Handa , LKML Subject: Re: [RFC 1/3] mm, oom: refactor oom detection Message-ID: <20151112123928.GH1174@dhcp22.suse.cz> References: <1446131835-3263-1-git-send-email-mhocko@kernel.org> <1446131835-3263-2-git-send-email-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1446131835-3263-2-git-send-email-mhocko@kernel.org> 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 On Thu 29-10-15 16:17:13, mhocko@kernel.org wrote: [...] > @@ -3135,13 +3145,56 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, > if (gfp_mask & __GFP_NORETRY) > goto noretry; > > - /* Keep reclaiming pages as long as there is reasonable progress */ > + /* > + * Do not retry high order allocations unless they are __GFP_REPEAT > + * and even then do not retry endlessly. > + */ > pages_reclaimed += did_some_progress; > - if ((did_some_progress && order <= PAGE_ALLOC_COSTLY_ORDER) || > - ((gfp_mask & __GFP_REPEAT) && pages_reclaimed < (1 << order))) { > - /* Wait for some write requests to complete then retry */ > - wait_iff_congested(ac->preferred_zone, BLK_RW_ASYNC, HZ/50); > - goto retry; > + if (order > PAGE_ALLOC_COSTLY_ORDER) { > + if (!(gfp_mask & __GFP_REPEAT) || pages_reclaimed >= (1< + goto noretry; This is not correct because we could fail __GFP_NOFAIL allocation. It should do if (!(gfp_mask & __GFP_NOFAIL) && (!(gfp_mask & __GFP_REPEAT) || pages_reclaimed >= (1< + > + if (did_some_progress) > + goto retry; > + } -- Michal Hocko SUSE Labs