From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753203AbdETTJO (ORCPT ); Sat, 20 May 2017 15:09:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751207AbdETTJN (ORCPT ); Sat, 20 May 2017 15:09:13 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5177480462 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mpatocka@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5177480462 Date: Sat, 20 May 2017 15:00:53 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Michal Hocko , Mike Snitzer cc: Junaid Shahid , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, andreslc@google.com, gthelen@google.com, rientjes@google.com, vbabka@suse.cz, dm-devel@redhat.com Subject: Re: [PATCH] dm ioctl: Restore __GFP_HIGH in copy_params() In-Reply-To: <20170520083412.GD11925@dhcp22.suse.cz> Message-ID: References: <20170518185040.108293-1-junaids@google.com> <20170520083412.GD11925@dhcp22.suse.cz> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 20 May 2017 19:01:01 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 20 May 2017, Michal Hocko wrote: > On Fri 19-05-17 19:50:24, Mikulas Patocka wrote: > > > > > > On Thu, 18 May 2017, 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. > > > > > > Signed-off-by: Junaid Shahid > > > > Acked-by: Mikulas Patocka > > Can we have a comment explaning why we need memory reserves in this case > please? Here I'm sending the patch with the comment: 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. Signed-off-by: Junaid Shahid Signed-off-by: Mikulas Patocka --- drivers/md/dm-ioctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Index: linux-2.6/drivers/md/dm-ioctl.c =================================================================== --- linux-2.6.orig/drivers/md/dm-ioctl.c +++ linux-2.6/drivers/md/dm-ioctl.c @@ -1710,12 +1710,13 @@ static int copy_params(struct dm_ioctl _ } /* - * Try to avoid low memory issues when a device is suspended. + * Use __GFP_HIGH to avoid low memory issues when a device is suspended + * and the ioctl is needed to resume it. * Use kmalloc() rather than vmalloc() when we can. */ 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) {