From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760283AbcBYJMU (ORCPT ); Thu, 25 Feb 2016 04:12:20 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:34944 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760237AbcBYJMM (ORCPT ); Thu, 25 Feb 2016 04:12:12 -0500 Subject: Re: [PATCH RFC] ext4: use __GFP_NOFAIL in ext4_free_blocks() To: Michal Hocko References: <20160224170912.2195.8153.stgit@buzz> <56CEC2EC.5000506@kyup.com> <20160225090839.GC17573@dhcp22.suse.cz> Cc: Konstantin Khlebnikov , "Theodore Ts'o" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Dmitry Monakhov , Johannes Weiner , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org From: Nikolay Borisov Message-ID: <56CEC568.6080809@kyup.com> Date: Thu, 25 Feb 2016 11:12:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20160225090839.GC17573@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 02/25/2016 11:08 AM, Michal Hocko wrote: > On Thu 25-02-16 11:01:32, Nikolay Borisov wrote: >> >> >> On 02/24/2016 07:09 PM, Konstantin Khlebnikov wrote: >>> This might be unexpected but pages allocated for sbi->s_buddy_cache are >>> charged to current memory cgroup. So, GFP_NOFS allocation could fail if >>> current task has been killed by OOM or if current memory cgroup has no >>> free memory left. Block allocator cannot handle such failures here yet. >>> >>> Signed-off-by: Konstantin Khlebnikov >> >> Adding new users of GFP_NOFAIL is deprecated. > > This is not true. GFP_NOFAIL should be used where the allocation failure > is no tolleratable and it is much more preferrable to doing an opencoded > endless loop over page allocator. In that case the comments in buffered_rmqueue, and the WARN_ON in __alloc_pages_may_oom and __alloc_pages_slowpath perhaps should be removed since they are misleading? > >> Where exactly does the >> block allocator fail, I skimmed the code and failing ext4_mb_load_buddy >> seems to be handled at all call sites. There are some BUG_ONs but from >> the comments there I guess they should occur when we try to find a page >> and not allocate a new one? > > I have posted a similar patch last year: > http://lkml.kernel.org/r/1438768284-30927-6-git-send-email-mhocko@kernel.org > because I could see emergency reboots when GFP_NOFS allocations were > allowed to fail. >