From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753815AbcD0Kxe (ORCPT ); Wed, 27 Apr 2016 06:53:34 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:48325 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750747AbcD0Kxd (ORCPT ); Wed, 27 Apr 2016 06:53:33 -0400 Subject: Re: [PATCH 1/2] mm: add PF_MEMALLOC_NOFS To: Michal Hocko , linux-mm@kvack.org References: <1461671772-1269-1-git-send-email-mhocko@kernel.org> <1461671772-1269-2-git-send-email-mhocko@kernel.org> Cc: Andrew Morton , Dave Chinner , "Theodore Ts'o" , Chris Mason , Jan Kara , LKML , Michal Hocko From: Tetsuo Handa Message-ID: <32e220de-6028-a32c-e6a5-6935b97d277d@I-love.SAKURA.ne.jp> Date: Wed, 27 Apr 2016 19:53:21 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1461671772-1269-2-git-send-email-mhocko@kernel.org> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/04/26 20:56, Michal Hocko wrote: > Not only this is easier to understand and maintain because there are > much less problematic contexts than specific allocation requests, this > also helps code paths where FS layer interacts with other layers (e.g. > crypto, security modules, MM etc...) and there is no easy way to convey > the allocation context between the layers. > You arrived at what I wished at http://lkml.kernel.org/r/201503172305.DIH52162.FOFMFOVJHLOtQS@I-love.SAKURA.ne.jp (i.e. not CONFIG_DEBUG_* but always enabled). > Introduce PF_MEMALLOC_NOFS task specific flag and memalloc_nofs_{save,restore} > API to control the scope. This is basically copying > memalloc_noio_{save,restore} API we have for other restricted allocation > context GFP_NOIO. > > Xfs has already had a similar functionality as PF_FSTRANS so let's just > give it a more generic name and make it usable for others as well and > move the GFP_NOFS context tracking to the page allocator. Xfs has its > own accessor functions but let's keep them for now to reduce this patch > as minimum. > > This patch shouldn't introduce any functional changes. Xfs code paths > preserve their semantic. kmem_flags_convert() doesn't need to evaluate > the flag anymore because it is the page allocator to care about the > flag. memalloc_noio_flags is renamed to current_gfp_context because it > now cares about both PF_MEMALLOC_NOFS and PF_MEMALLOC_NOIO contexts. > > Let's hope that filesystems will drop direct GFP_NOFS (resp. ~__GFP_FS) > usage as much and possible and only use a properly documented > memalloc_nofs_{save,restore} checkpoints where they are appropriate. Is the story simple enough to monotonically replace GFP_NOFS/GFP_NOIO with GFP_KERNEL after memalloc_no{fs,io}_{save,restore} are inserted? We sometimes delegate some operations to somebody else. Don't we need to convey PF_MEMALLOC_NOFS/PF_MEMALLOC_NOIO flags to APIs which interact with other threads?