lkml.org 
[lkml]   [2009]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/7] dm: use __GFP_HIGH instead PF_MEMALLOC
Date
Non MM subsystem must not use PF_MEMALLOC. Memory reclaim need few
memory, anyone must not prevent it. Otherwise the system cause
mysterious hang-up and/or OOM Killer invokation.

Cc: Alasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
drivers/md/dm-ioctl.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index a679429..4d24b0a 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1396,7 +1396,13 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param)
if (tmp.data_size < (sizeof(tmp) - sizeof(tmp.data)))
return -EINVAL;

- dmi = vmalloc(tmp.data_size);
+
+ /*
+ * We use __vmalloc(__GFP_HIGH) instead vmalloc() because trying to
+ * avoid low memory issues when a device is suspended.
+ */
+ dmi = __vmalloc(tmp.data_size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_HIGH,
+ PAGE_KERNEL);
if (!dmi)
return -ENOMEM;

@@ -1473,20 +1479,10 @@ static int ctl_ioctl(uint command, struct dm_ioctl __user *user)
DMWARN("dm_ctl_ioctl: unknown command 0x%x", command);
return -ENOTTY;
}
-
- /*
- * Trying to avoid low memory issues when a device is
- * suspended.
- */
- current->flags |= PF_MEMALLOC;
-
/*
* Copy the parameters into kernel space.
*/
r = copy_params(user, &param);
-
- current->flags &= ~PF_MEMALLOC;
-
if (r)
return r;

--
1.6.2.5




\
 
 \ /
  Last update: 2009-11-17 08:19    [W:0.177 / U:4.688 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site