From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751584AbcGRLef (ORCPT ); Mon, 18 Jul 2016 07:34:35 -0400 Received: from mx2.suse.de ([195.135.220.15]:44612 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbcGRLed (ORCPT ); Mon, 18 Jul 2016 07:34:33 -0400 Subject: Re: [PATCH 3/8] mm, page_alloc: don't retry initial attempt in slowpath To: Michal Hocko References: <20160718112302.27381-1-vbabka@suse.cz> <20160718112302.27381-4-vbabka@suse.cz> <20160718112939.GH22671@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: <6a427871-c1fb-77e7-2f45-1c4be436fa23@suse.cz> Date: Mon, 18 Jul 2016 13:34:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160718112939.GH22671@dhcp22.suse.cz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/18/2016 01:29 PM, Michal Hocko wrote: > On Mon 18-07-16 13:22:57, Vlastimil Babka wrote: >> After __alloc_pages_slowpath() sets up new alloc_flags and wakes up kswapd, it >> first tries get_page_from_freelist() with the new alloc_flags, as it may >> succeed e.g. due to using min watermark instead of low watermark. It makes >> sense to to do this attempt before adjusting zonelist based on >> alloc_flags/gfp_mask, as it's still relatively a fast path if we just wake up >> kswapd and successfully allocate. >> >> This patch therefore moves the initial attempt above the retry label and >> reorganizes a bit the part below the retry label. We still have to attempt >> get_page_from_freelist() on each retry, as some allocations cannot do that >> as part of direct reclaim or compaction, and yet are not allowed to fail >> (even though they do a WARN_ON_ONCE() and thus should not exist). We can reuse >> the call meant for ALLOC_NO_WATERMARKS attempt and just set alloc_flags to >> ALLOC_NO_WATERMARKS if the context allows it. As a side-effect, the attempts >> from direct reclaim/compaction will also no longer obey watermarks once this >> is set, but there's little harm in that. >> >> Kswapd wakeups are also done on each retry to be safe from potential races >> resulting in kswapd going to sleep while a process (that may not be able to >> reclaim by itself) is still looping. >> >> Signed-off-by: Vlastimil Babka > > Same here, my ack still holds > Acked-by: Michal Hocko Sorry, forgot to add them before sending. Thanks for both!