linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Michal Hocko <mhocko@kernel.org>, Mike Snitzer <msnitzer@redhat.com>
Cc: Junaid Shahid <junaids@google.com>,
	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()
Date: Sat, 20 May 2017 15:00:53 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.1705201458500.1841@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <20170520083412.GD11925@dhcp22.suse.cz>



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 <junaids@google.com>
> > 
> > Acked-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> 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 <junaids@google.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 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) {

      parent reply	other threads:[~2017-05-20 19:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170518185040.108293-1-junaids@google.com>
     [not found] ` <20170518190406.GB2330@dhcp22.suse.cz>
     [not found]   ` <alpine.DEB.2.10.1705181338090.132717@chino.kir.corp.google.com>
2017-05-19  2:50     ` [PATCH] dm ioctl: Restore __GFP_HIGH in copy_params() Junaid Shahid
2017-05-19  7:46       ` Michal Hocko
2017-05-19 23:43         ` Mikulas Patocka
2017-05-22  9:37           ` Michal Hocko
2017-05-22 12:00             ` Mikulas Patocka
2017-05-22 12:09               ` Michal Hocko
2017-05-22 14:52                 ` Mikulas Patocka
2017-05-22 15:03                   ` Michal Hocko
2017-05-22 18:04                     ` Mike Snitzer
2017-05-22 20:35                       ` David Rientjes
2017-05-22 23:35                         ` Mike Snitzer
2017-05-23  6:05                         ` Michal Hocko
2017-05-23 16:44                           ` Mikulas Patocka
2017-05-25  8:58                             ` Michal Hocko
2017-05-23  6:49                       ` Michal Hocko
     [not found] ` <alpine.LRH.2.02.1705191949340.17646@file01.intranet.prod.int.rdu2.redhat.com>
     [not found]   ` <20170520083412.GD11925@dhcp22.suse.cz>
2017-05-20 19:00     ` Mikulas Patocka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.02.1705201458500.1841@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreslc@google.com \
    --cc=dm-devel@redhat.com \
    --cc=gthelen@google.com \
    --cc=junaids@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=msnitzer@redhat.com \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).