From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756145AbdESCuu (ORCPT ); Thu, 18 May 2017 22:50:50 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:36325 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754840AbdESCus (ORCPT ); Thu, 18 May 2017 22:50:48 -0400 From: Junaid Shahid To: David Rientjes Cc: Michal Hocko , Alasdair Kergon , Mike Snitzer , Andrew Morton , linux-mm@kvack.org, andreslc@google.com, gthelen@google.com, mpatocka@redhat.com, vbabka@suse.cz, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dm ioctl: Restore __GFP_HIGH in copy_params() Date: Thu, 18 May 2017 19:50:46 -0700 Message-ID: <1508444.i5EqlA1upv@js-desktop.svl.corp.google.com> Organization: Google User-Agent: KMail/4.13.3 (Linux/4.4.0-75-generic; KDE/4.13.3; x86_64; ; ) In-Reply-To: References: <20170518185040.108293-1-junaids@google.com> <20170518190406.GB2330@dhcp22.suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (Adding back the correct linux-mm email address and also adding linux-kernel.) On Thursday, May 18, 2017 01:41:33 PM David Rientjes wrote: > On Thu, 18 May 2017, Michal Hocko wrote: > > > On Thu 18-05-17 11:50:40, Junaid Shahid wrote: > > > d224e9381897 (drivers/md/dm-ioctl.c: use kvmalloc rather than opencoded > > > variant) left out the __GFP_HIGH flag when converting from __vmalloc to > > > kvmalloc. This can cause the IOCTL to fail in some low memory situations > > > where it wouldn't have failed earlier. This patch adds it back to avoid > > > any potential regression. > > > > The code previously used __GFP_HIGH only for the vmalloc fallback and > > that doesn't make that much sense with the current implementation > > because vmalloc does order-0 pages and those do not really fail and the > > oom killer is invoked to free memory. > > > > Order-0 pages certainly do fail, there is not an infinite amount of memory > nor is there a specific exemption to allow order-0 memory to be alloctable > below watermarks without this gfp flag. OOM kill is the last thing we > want for these allocations since they are very temporary. > > > There is no reason to access memory reserves from this context. > > > > Let's ask Mikulas, who changed this from PF_MEMALLOC to __GFP_HIGH, > assuming there was a reason to do it in the first place in two different > ways. > > This decision is up to the device mapper maintainers. > > > > Signed-off-by: Junaid Shahid > > > --- > > > drivers/md/dm-ioctl.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c > > > index 0555b4410e05..bacad7637a56 100644 > > > --- a/drivers/md/dm-ioctl.c > > > +++ b/drivers/md/dm-ioctl.c > > > @@ -1715,7 +1715,7 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kern > > > */ > > > dmi = NULL; > > > noio_flag = memalloc_noio_save(); > > > - dmi = kvmalloc(param_kernel->data_size, GFP_KERNEL); > > > + dmi = kvmalloc(param_kernel->data_size, GFP_KERNEL | __GFP_HIGH); > > > memalloc_noio_restore(noio_flag); > > > > > > if (!dmi) {