mm: treewide: remove GFP_TEMPORARY allocation flag
authorMichal Hocko <mhocko@suse.com>
Wed, 13 Sep 2017 23:28:29 +0000 (16:28 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 14 Sep 2017 01:53:16 +0000 (18:53 -0700)
GFP_TEMPORARY was introduced by commit e12ba74d8ff3 ("Group short-lived
and reclaimable kernel allocations") along with __GFP_RECLAIMABLE.  It's
primary motivation was to allow users to tell that an allocation is
short lived and so the allocator can try to place such allocations close
together and prevent long term fragmentation.  As much as this sounds
like a reasonable semantic it becomes much less clear when to use the
highlevel GFP_TEMPORARY allocation flag.  How long is temporary? Can the
context holding that memory sleep? Can it take locks? It seems there is
no good answer for those questions.

The current implementation of GFP_TEMPORARY is basically GFP_KERNEL |
__GFP_RECLAIMABLE which in itself is tricky because basically none of
the existing caller provide a way to reclaim the allocated memory.  So
this is rather misleading and hard to evaluate for any benefits.

I have checked some random users and none of them has added the flag
with a specific justification.  I suspect most of them just copied from
other existing users and others just thought it might be a good idea to
use without any measuring.  This suggests that GFP_TEMPORARY just
motivates for cargo cult usage without any reasoning.

I believe that our gfp flags are quite complex already and especially
those with highlevel semantic should be clearly defined to prevent from
confusion and abuse.  Therefore I propose dropping GFP_TEMPORARY and
replace all existing users to simply use GFP_KERNEL.  Please note that
SLAB users with shrinkers will still get __GFP_RECLAIMABLE heuristic and
so they will be placed properly for memory fragmentation prevention.

I can see reasons we might want some gfp flag to reflect shorterm
allocations but I propose starting from a clear semantic definition and
only then add users with proper justification.

This was been brought up before LSF this year by Matthew [1] and it
turned out that GFP_TEMPORARY really doesn't have a clear semantic.  It
seems to be a heuristic without any measured advantage for most (if not
all) its current users.  The follow up discussion has revealed that
opinions on what might be temporary allocation differ a lot between
developers.  So rather than trying to tweak existing users into a
semantic which they haven't expected I propose to simply remove the flag
and start from scratch if we really need a semantic for short term
allocations.

[1] http://lkml.kernel.org/r/20170118054945.GD18349@bombadil.infradead.org

[akpm@linux-foundation.org: fix typo]
[akpm@linux-foundation.org: coding-style fixes]
[sfr@canb.auug.org.au: drm/i915: fix up]
Link: http://lkml.kernel.org/r/20170816144703.378d4f4d@canb.auug.org.au
Link: http://lkml.kernel.org/r/20170728091904.14627-1-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Mel Gorman <mgorman@suse.de>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Neil Brown <neilb@suse.de>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
36 files changed:
arch/arc/kernel/setup.c
arch/arc/kernel/troubleshoot.c
arch/powerpc/kernel/rtas.c
arch/powerpc/platforms/pseries/suspend.c
drivers/gpu/drm/drm_blend.c
drivers/gpu/drm/drm_dp_dual_mode_helper.c
drivers/gpu/drm/drm_scdc_helper.c
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_gem_userptr.c
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/selftests/i915_random.c
drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c
drivers/gpu/drm/i915/selftests/intel_uncore.c
drivers/gpu/drm/lib/drm_random.c
drivers/gpu/drm/msm/msm_gem_submit.c
drivers/gpu/drm/selftests/test-drm_mm.c
drivers/misc/cxl/pci.c
drivers/xen/gntalloc.c
fs/coredump.c
fs/exec.c
fs/overlayfs/copy_up.c
fs/overlayfs/dir.c
fs/overlayfs/namei.c
fs/proc/base.c
fs/proc/task_mmu.c
include/linux/gfp.h
include/trace/events/mmflags.h
kernel/locking/test-ww_mutex.c
kernel/trace/trace_events_filter.c
lib/string_helpers.c
mm/shmem.c
mm/slub.c
tools/perf/builtin-kmem.c

index c4ffb441716c405d61cc16fd74e6fe071076940f..877cec8f5ea21256e233f4f353882ff02097537a 100644 (file)
@@ -510,7 +510,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                goto done;
        }
 
-       str = (char *)__get_free_page(GFP_TEMPORARY);
+       str = (char *)__get_free_page(GFP_KERNEL);
        if (!str)
                goto done;
 
index 7e94476f39943026eda5522f281d50233b4d8d79..7d8c1d6c2f60f918e95f2cafc81c90c028684b9a 100644 (file)
@@ -178,7 +178,7 @@ void show_regs(struct pt_regs *regs)
        struct callee_regs *cregs;
        char *buf;
 
-       buf = (char *)__get_free_page(GFP_TEMPORARY);
+       buf = (char *)__get_free_page(GFP_KERNEL);
        if (!buf)
                return;
 
index b8a4987f58cfdc6ccd66a94d68eea419bc68a37c..1643e9e5365573659bbdf79d6e5dfddb5ee4eafc 100644 (file)
@@ -914,7 +914,7 @@ int rtas_online_cpus_mask(cpumask_var_t cpus)
        if (ret) {
                cpumask_var_t tmp_mask;
 
-               if (!alloc_cpumask_var(&tmp_mask, GFP_TEMPORARY))
+               if (!alloc_cpumask_var(&tmp_mask, GFP_KERNEL))
                        return ret;
 
                /* Use tmp_mask to preserve cpus mask from first failure */
@@ -962,7 +962,7 @@ int rtas_ibm_suspend_me(u64 handle)
                return -EIO;
        }
 
-       if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY))
+       if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL))
                return -ENOMEM;
 
        atomic_set(&data.working, 0);
index e76aefae2aa2b1020e90180b6f4e930acece7294..89726f07d2492fd17beb05eea48c476fd2652550 100644 (file)
@@ -151,7 +151,7 @@ static ssize_t store_hibernate(struct device *dev,
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY))
+       if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL))
                return -ENOMEM;
 
        stream_id = simple_strtoul(buf, NULL, 16);
index db6aeec50b821eb119fc0e0b6d5885a26350c56f..2e5e089dd9123fa324e1a7d343d8bb47a200739b 100644 (file)
@@ -319,7 +319,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
        DRM_DEBUG_ATOMIC("[CRTC:%d:%s] calculating normalized zpos values\n",
                         crtc->base.id, crtc->name);
 
-       states = kmalloc_array(total_planes, sizeof(*states), GFP_TEMPORARY);
+       states = kmalloc_array(total_planes, sizeof(*states), GFP_KERNEL);
        if (!states)
                return -ENOMEM;
 
index 80e62f6693215f1deaf9d40af232f56d800d9ac3..0ef9011a1856358b2bc6104973888a69f76db8e7 100644 (file)
@@ -111,7 +111,7 @@ ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
        void *data;
        int ret;
 
-       data = kmalloc(msg.len, GFP_TEMPORARY);
+       data = kmalloc(msg.len, GFP_KERNEL);
        if (!data)
                return -ENOMEM;
 
index 7d1b0f011d33e1d796890bb71c88458b0ae6d054..935653eb3616c997064fb166cb0d1ce8e839e4b7 100644 (file)
@@ -102,7 +102,7 @@ ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,
        void *data;
        int err;
 
-       data = kmalloc(1 + size, GFP_TEMPORARY);
+       data = kmalloc(1 + size, GFP_KERNEL);
        if (!data)
                return -ENOMEM;
 
index a7ff2e4c00d26b35ca7e80bccf8d24317b642399..026ef4e02f85cab130586c5c0b8c9b97bd0101bb 100644 (file)
@@ -37,7 +37,7 @@ static struct etnaviv_gem_submit *submit_create(struct drm_device *dev,
        struct etnaviv_gem_submit *submit;
        size_t sz = size_vstruct(nr, sizeof(submit->bos[0]), sizeof(*submit));
 
-       submit = kmalloc(sz, GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY);
+       submit = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
        if (submit) {
                submit->dev = dev;
                submit->gpu = gpu;
index 57317715977f940039ace12cf79c4a7f67c2056d..19404c96eeb10670da75ce5426c96c10f6a5d7e1 100644 (file)
@@ -2540,7 +2540,7 @@ static void *i915_gem_object_map(const struct drm_i915_gem_object *obj,
 
        if (n_pages > ARRAY_SIZE(stack_pages)) {
                /* Too big for stack -- allocate temporary array instead */
-               pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_TEMPORARY);
+               pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_KERNEL);
                if (!pages)
                        return NULL;
        }
index 50d5e24f91a9daa861ba2156ccdfe7588d48e899..92437f455b43ca1a23c28935337cb7eba124aa58 100644 (file)
@@ -293,7 +293,7 @@ static int eb_create(struct i915_execbuffer *eb)
                         * as possible to perform the allocation and warn
                         * if it fails.
                         */
-                       flags = GFP_TEMPORARY;
+                       flags = GFP_KERNEL;
                        if (size > 1)
                                flags |= __GFP_NORETRY | __GFP_NOWARN;
 
@@ -1515,7 +1515,7 @@ static int eb_copy_relocations(const struct i915_execbuffer *eb)
                urelocs = u64_to_user_ptr(eb->exec[i].relocs_ptr);
                size = nreloc * sizeof(*relocs);
 
-               relocs = kvmalloc_array(size, 1, GFP_TEMPORARY);
+               relocs = kvmalloc_array(size, 1, GFP_KERNEL);
                if (!relocs) {
                        kvfree(relocs);
                        err = -ENOMEM;
@@ -2077,7 +2077,7 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
                return ERR_PTR(-EFAULT);
 
        fences = kvmalloc_array(args->num_cliprects, sizeof(*fences),
-                               __GFP_NOWARN | GFP_TEMPORARY);
+                               __GFP_NOWARN | GFP_KERNEL);
        if (!fences)
                return ERR_PTR(-ENOMEM);
 
@@ -2463,9 +2463,9 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
 
        /* Copy in the exec list from userland */
        exec_list = kvmalloc_array(args->buffer_count, sizeof(*exec_list),
-                                  __GFP_NOWARN | GFP_TEMPORARY);
+                                  __GFP_NOWARN | GFP_KERNEL);
        exec2_list = kvmalloc_array(args->buffer_count + 1, sz,
-                                   __GFP_NOWARN | GFP_TEMPORARY);
+                                   __GFP_NOWARN | GFP_KERNEL);
        if (exec_list == NULL || exec2_list == NULL) {
                DRM_DEBUG("Failed to allocate exec list for %d buffers\n",
                          args->buffer_count);
@@ -2543,7 +2543,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
 
        /* Allocate an extra slot for use by the command parser */
        exec2_list = kvmalloc_array(args->buffer_count + 1, sz,
-                                   __GFP_NOWARN | GFP_TEMPORARY);
+                                   __GFP_NOWARN | GFP_KERNEL);
        if (exec2_list == NULL) {
                DRM_DEBUG("Failed to allocate exec list for %d buffers\n",
                          args->buffer_count);
index 0d5a988b3867792a1f8bf069475a1a57042b11f8..e2410eb5d96e01ce208f565fee182da9a99ee604 100644 (file)
@@ -3231,7 +3231,7 @@ intel_rotate_pages(struct intel_rotation_info *rot_info,
        /* Allocate a temporary list of source pages for random access. */
        page_addr_list = kvmalloc_array(n_pages,
                                        sizeof(dma_addr_t),
-                                       GFP_TEMPORARY);
+                                       GFP_KERNEL);
        if (!page_addr_list)
                return ERR_PTR(ret);
 
index 23fd18bd1b56b7f54c7d16cc3d5f1b72a03aaf71..709efe2357eac9948ba71a76e11c02ace9f6ae4c 100644 (file)
@@ -507,7 +507,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
        ret = -ENOMEM;
        pinned = 0;
 
-       pvec = kvmalloc_array(npages, sizeof(struct page *), GFP_TEMPORARY);
+       pvec = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
        if (pvec != NULL) {
                struct mm_struct *mm = obj->userptr.mm->mm;
                unsigned int flags = 0;
@@ -643,7 +643,7 @@ i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)
 
        if (mm == current->mm) {
                pvec = kvmalloc_array(num_pages, sizeof(struct page *),
-                                     GFP_TEMPORARY |
+                                     GFP_KERNEL |
                                      __GFP_NORETRY |
                                      __GFP_NOWARN);
                if (pvec) /* defer to worker if malloc fails */
index ed5a1eb839ad57951bf56b3ae0e886cbfbf88428..0c779671fe2df976eceba035b45df01e9dc82f64 100644 (file)
@@ -787,16 +787,16 @@ int i915_error_state_buf_init(struct drm_i915_error_state_buf *ebuf,
         */
        ebuf->size = count + 1 > PAGE_SIZE ? count + 1 : PAGE_SIZE;
        ebuf->buf = kmalloc(ebuf->size,
-                               GFP_TEMPORARY | __GFP_NORETRY | __GFP_NOWARN);
+                               GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
 
        if (ebuf->buf == NULL) {
                ebuf->size = PAGE_SIZE;
-               ebuf->buf = kmalloc(ebuf->size, GFP_TEMPORARY);
+               ebuf->buf = kmalloc(ebuf->size, GFP_KERNEL);
        }
 
        if (ebuf->buf == NULL) {
                ebuf->size = 128;
-               ebuf->buf = kmalloc(ebuf->size, GFP_TEMPORARY);
+               ebuf->buf = kmalloc(ebuf->size, GFP_KERNEL);
        }
 
        if (ebuf->buf == NULL)
index d044bf9a6feb37e6036b44e83a0a70dc1b7f03cb..222c511bea494585b08d9a6c41701065517526bd 100644 (file)
@@ -62,7 +62,7 @@ unsigned int *i915_random_order(unsigned int count, struct rnd_state *state)
 {
        unsigned int *order, i;
 
-       order = kmalloc_array(count, sizeof(*order), GFP_TEMPORARY);
+       order = kmalloc_array(count, sizeof(*order), GFP_KERNEL);
        if (!order)
                return order;
 
index 7276194c04f7fab3330e032963e47f04c1bd3e78..828904b7d46831f4dc6040cdf7085ffff515275b 100644 (file)
@@ -117,12 +117,12 @@ static int igt_random_insert_remove(void *arg)
 
        mock_engine_reset(engine);
 
-       waiters = kvmalloc_array(count, sizeof(*waiters), GFP_TEMPORARY);
+       waiters = kvmalloc_array(count, sizeof(*waiters), GFP_KERNEL);
        if (!waiters)
                goto out_engines;
 
        bitmap = kcalloc(DIV_ROUND_UP(count, BITS_PER_LONG), sizeof(*bitmap),
-                        GFP_TEMPORARY);
+                        GFP_KERNEL);
        if (!bitmap)
                goto out_waiters;
 
@@ -187,12 +187,12 @@ static int igt_insert_complete(void *arg)
 
        mock_engine_reset(engine);
 
-       waiters = kvmalloc_array(count, sizeof(*waiters), GFP_TEMPORARY);
+       waiters = kvmalloc_array(count, sizeof(*waiters), GFP_KERNEL);
        if (!waiters)
                goto out_engines;
 
        bitmap = kcalloc(DIV_ROUND_UP(count, BITS_PER_LONG), sizeof(*bitmap),
-                        GFP_TEMPORARY);
+                        GFP_KERNEL);
        if (!bitmap)
                goto out_waiters;
 
@@ -368,7 +368,7 @@ static int igt_wakeup(void *arg)
 
        mock_engine_reset(engine);
 
-       waiters = kvmalloc_array(count, sizeof(*waiters), GFP_TEMPORARY);
+       waiters = kvmalloc_array(count, sizeof(*waiters), GFP_KERNEL);
        if (!waiters)
                goto out_engines;
 
index 2d0fef2cfca6342b25736f2e4d9a33c8b7623c8f..3cac22eb47ce10efaac456b25d0a3f210b6b6ff5 100644 (file)
@@ -127,7 +127,7 @@ static int intel_uncore_check_forcewake_domains(struct drm_i915_private *dev_pri
                return 0;
 
        valid = kzalloc(BITS_TO_LONGS(FW_RANGE) * sizeof(*valid),
-                       GFP_TEMPORARY);
+                       GFP_KERNEL);
        if (!valid)
                return -ENOMEM;
 
index 7b12a68c3b54bc4b670c2f7024e661760a1fe5d7..a78c4b483e8dd613228f41e695155c850b00366d 100644 (file)
@@ -28,7 +28,7 @@ unsigned int *drm_random_order(unsigned int count, struct rnd_state *state)
 {
        unsigned int *order, i;
 
-       order = kmalloc_array(count, sizeof(*order), GFP_TEMPORARY);
+       order = kmalloc_array(count, sizeof(*order), GFP_KERNEL);
        if (!order)
                return order;
 
index 8a75c0bd8a78b1481e30fdab63f2d14bfc64536d..5d0a75d4b249c439ff9ff072f89c87c5e95bd776 100644 (file)
@@ -40,7 +40,7 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev,
        if (sz > SIZE_MAX)
                return NULL;
 
-       submit = kmalloc(sz, GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY);
+       submit = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
        if (!submit)
                return NULL;
 
index dfdd858eda0a0640addf1511948d78c0e04678dd..86eb4c185a28547589fb4b8a53433351a6738536 100644 (file)
@@ -1627,7 +1627,7 @@ static int igt_topdown(void *ignored)
                goto err;
 
        bitmap = kzalloc(count / BITS_PER_LONG * sizeof(unsigned long),
-                        GFP_TEMPORARY);
+                        GFP_KERNEL);
        if (!bitmap)
                goto err_nodes;
 
@@ -1741,7 +1741,7 @@ static int igt_bottomup(void *ignored)
                goto err;
 
        bitmap = kzalloc(count / BITS_PER_LONG * sizeof(unsigned long),
-                        GFP_TEMPORARY);
+                        GFP_KERNEL);
        if (!bitmap)
                goto err_nodes;
 
index d18b3d9292fdb718fa87a64542168d5f904aa5e8..3ba04f371380d24af78a99750f548aecfad7a34c 100644 (file)
@@ -1279,7 +1279,7 @@ ssize_t cxl_pci_afu_read_err_buffer(struct cxl_afu *afu, char *buf,
        }
 
        /* use bounce buffer for copy */
-       tbuf = (void *)__get_free_page(GFP_TEMPORARY);
+       tbuf = (void *)__get_free_page(GFP_KERNEL);
        if (!tbuf)
                return -ENOMEM;
 
index 1bf55a32a4b378d7b5f907b73051c8f36eb937f6..3fa40c723e8e95cb85d8c4ee5449ac716cb43e63 100644 (file)
@@ -294,7 +294,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv,
                goto out;
        }
 
-       gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_TEMPORARY);
+       gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_KERNEL);
        if (!gref_ids) {
                rc = -ENOMEM;
                goto out;
index 592683711c6432e3a9fa8eabcb95a7934b2b5571..0eec03696707f03d498d1e4596c1c2cfdbb66873 100644 (file)
@@ -161,7 +161,7 @@ static int cn_print_exe_file(struct core_name *cn)
        if (!exe_file)
                return cn_esc_printf(cn, "%s (path unknown)", current->comm);
 
-       pathbuf = kmalloc(PATH_MAX, GFP_TEMPORARY);
+       pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
        if (!pathbuf) {
                ret = -ENOMEM;
                goto put_exe_file;
index 01a9fb9d8ac3a332e0e28b79d20ffb9a768b38ba..daa19d85c066bfbf00a1ce27bfb4de22aa10e466 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1763,9 +1763,9 @@ static int do_execveat_common(int fd, struct filename *filename,
                bprm->filename = filename->name;
        } else {
                if (filename->name[0] == '\0')
-                       pathbuf = kasprintf(GFP_TEMPORARY, "/dev/fd/%d", fd);
+                       pathbuf = kasprintf(GFP_KERNEL, "/dev/fd/%d", fd);
                else
-                       pathbuf = kasprintf(GFP_TEMPORARY, "/dev/fd/%d/%s",
+                       pathbuf = kasprintf(GFP_KERNEL, "/dev/fd/%d/%s",
                                            fd, filename->name);
                if (!pathbuf) {
                        retval = -ENOMEM;
index acb6f97deb97ccd25c7a3b785f1ae1280858d6c4..aad97b30d5e657199f741f02700208c41e5424ae 100644 (file)
@@ -241,7 +241,7 @@ struct ovl_fh *ovl_encode_fh(struct dentry *lower, bool is_upper)
        int buflen = MAX_HANDLE_SZ;
        uuid_t *uuid = &lower->d_sb->s_uuid;
 
-       buf = kmalloc(buflen, GFP_TEMPORARY);
+       buf = kmalloc(buflen, GFP_KERNEL);
        if (!buf)
                return ERR_PTR(-ENOMEM);
 
index 9cb0c80e5967e5b9fec893e7645d77c41db457f6..3309b1912241769bba93e2caba483a4e2f57035a 100644 (file)
@@ -833,7 +833,7 @@ static char *ovl_get_redirect(struct dentry *dentry, bool samedir)
                goto out;
        }
 
-       buf = ret = kmalloc(buflen, GFP_TEMPORARY);
+       buf = ret = kmalloc(buflen, GFP_KERNEL);
        if (!buf)
                goto out;
 
index 8aef2b304b2d2bd2ad0c26942765e4bca0362835..c3addd1114f1f562464370e6d640abd22cd3a3e4 100644 (file)
@@ -38,7 +38,7 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d,
                        return 0;
                goto fail;
        }
-       buf = kzalloc(prelen + res + strlen(post) + 1, GFP_TEMPORARY);
+       buf = kzalloc(prelen + res + strlen(post) + 1, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
 
@@ -103,7 +103,7 @@ static struct ovl_fh *ovl_get_origin_fh(struct dentry *dentry)
        if (res == 0)
                return NULL;
 
-       fh = kzalloc(res, GFP_TEMPORARY);
+       fh  = kzalloc(res, GFP_KERNEL);
        if (!fh)
                return ERR_PTR(-ENOMEM);
 
@@ -309,7 +309,7 @@ static int ovl_check_origin(struct dentry *upperdentry,
 
        BUG_ON(*ctrp);
        if (!*stackp)
-               *stackp = kmalloc(sizeof(struct path), GFP_TEMPORARY);
+               *stackp = kmalloc(sizeof(struct path), GFP_KERNEL);
        if (!*stackp) {
                dput(origin);
                return -ENOMEM;
@@ -418,7 +418,7 @@ int ovl_verify_index(struct dentry *index, struct path *lowerstack,
 
        err = -ENOMEM;
        len = index->d_name.len / 2;
-       fh = kzalloc(len, GFP_TEMPORARY);
+       fh = kzalloc(len, GFP_KERNEL);
        if (!fh)
                goto fail;
 
@@ -478,7 +478,7 @@ int ovl_get_index_name(struct dentry *origin, struct qstr *name)
                return PTR_ERR(fh);
 
        err = -ENOMEM;
-       n = kzalloc(fh->len * 2, GFP_TEMPORARY);
+       n = kzalloc(fh->len * 2, GFP_KERNEL);
        if (n) {
                s  = bin2hex(n, fh, fh->len);
                *name = (struct qstr) QSTR_INIT(n, s - n);
@@ -646,7 +646,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
        if (!d.stop && poe->numlower) {
                err = -ENOMEM;
                stack = kcalloc(ofs->numlower, sizeof(struct path),
-                               GFP_TEMPORARY);
+                               GFP_KERNEL);
                if (!stack)
                        goto out_put_upper;
        }
index e5d89a0d0b8a7bceb29dae702436a572dc041336..ad3b0762cc3e952bf7c8c7bd717d186d93c21376 100644 (file)
@@ -232,7 +232,7 @@ static ssize_t proc_pid_cmdline_read(struct file *file, char __user *buf,
                goto out_mmput;
        }
 
-       page = (char *)__get_free_page(GFP_TEMPORARY);
+       page = (char *)__get_free_page(GFP_KERNEL);
        if (!page) {
                rv = -ENOMEM;
                goto out_mmput;
@@ -813,7 +813,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
        if (!mm)
                return 0;
 
-       page = (char *)__get_free_page(GFP_TEMPORARY);
+       page = (char *)__get_free_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;
 
@@ -918,7 +918,7 @@ static ssize_t environ_read(struct file *file, char __user *buf,
        if (!mm || !mm->env_end)
                return 0;
 
-       page = (char *)__get_free_page(GFP_TEMPORARY);
+       page = (char *)__get_free_page(GFP_KERNEL);
        if (!page)
                return -ENOMEM;
 
@@ -1630,7 +1630,7 @@ out:
 
 static int do_proc_readlink(struct path *path, char __user *buffer, int buflen)
 {
-       char *tmp = (char*)__get_free_page(GFP_TEMPORARY);
+       char *tmp = (char *)__get_free_page(GFP_KERNEL);
        char *pathname;
        int len;
 
index 7b40e11ede9bbf718e31e23819bf36cfd1093b76..5589b4bd4b858fa5369728f0a0a2b90b4a3052ae 100644 (file)
@@ -1474,7 +1474,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
        pm.show_pfn = file_ns_capable(file, &init_user_ns, CAP_SYS_ADMIN);
 
        pm.len = (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);
-       pm.buffer = kmalloc(pm.len * PM_ENTRY_BYTES, GFP_TEMPORARY);
+       pm.buffer = kmalloc(pm.len * PM_ENTRY_BYTES, GFP_KERNEL);
        ret = -ENOMEM;
        if (!pm.buffer)
                goto out_mm;
index bcfb9f7c46f5dc3d1d8f6d8f2f454e09243a610d..f780718b7391d40999962bed20621c2b8b0cca21 100644 (file)
@@ -288,8 +288,6 @@ struct vm_area_struct;
 #define GFP_NOWAIT     (__GFP_KSWAPD_RECLAIM)
 #define GFP_NOIO       (__GFP_RECLAIM)
 #define GFP_NOFS       (__GFP_RECLAIM | __GFP_IO)
-#define GFP_TEMPORARY  (__GFP_RECLAIM | __GFP_IO | __GFP_FS | \
-                        __GFP_RECLAIMABLE)
 #define GFP_USER       (__GFP_RECLAIM | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
 #define GFP_DMA                __GFP_DMA
 #define GFP_DMA32      __GFP_DMA32
index 4c2e4737d7bcc50a988e9312cc1fe7344ca491d9..fec6291a67036fb6d9b118f53850612e81ab3d54 100644 (file)
@@ -18,7 +18,6 @@
        {(unsigned long)GFP_HIGHUSER_MOVABLE,   "GFP_HIGHUSER_MOVABLE"},\
        {(unsigned long)GFP_HIGHUSER,           "GFP_HIGHUSER"},        \
        {(unsigned long)GFP_USER,               "GFP_USER"},            \
-       {(unsigned long)GFP_TEMPORARY,          "GFP_TEMPORARY"},       \
        {(unsigned long)GFP_KERNEL_ACCOUNT,     "GFP_KERNEL_ACCOUNT"},  \
        {(unsigned long)GFP_KERNEL,             "GFP_KERNEL"},          \
        {(unsigned long)GFP_NOFS,               "GFP_NOFS"},            \
index 39f56c870051b505611746ff0033cc6a7f6e1a10..0e4cd64ad2c018cf4ad2375004b966d6de49c241 100644 (file)
@@ -362,7 +362,7 @@ static int *get_random_order(int count)
        int *order;
        int n, r, tmp;
 
-       order = kmalloc_array(count, sizeof(*order), GFP_TEMPORARY);
+       order = kmalloc_array(count, sizeof(*order), GFP_KERNEL);
        if (!order)
                return order;
 
index 181e139a8057bed695ad6d1d7460036e378f5ca0..61e7f0678d3359fe77c52beb27e7d47a48865570 100644 (file)
@@ -702,7 +702,7 @@ static void append_filter_err(struct filter_parse_state *ps,
        int pos = ps->lasterr_pos;
        char *buf, *pbuf;
 
-       buf = (char *)__get_free_page(GFP_TEMPORARY);
+       buf = (char *)__get_free_page(GFP_KERNEL);
        if (!buf)
                return;
 
index ecaac2c0526fcaf555fff4d22ecbd172d933e7bd..29c490e5d47858ce18da95d63608a147f9b1ecd7 100644 (file)
@@ -576,7 +576,7 @@ char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp)
        char *buffer, *quoted;
        int i, res;
 
-       buffer = kmalloc(PAGE_SIZE, GFP_TEMPORARY);
+       buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
        if (!buffer)
                return NULL;
 
@@ -612,7 +612,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp)
                return kstrdup("<unknown>", gfp);
 
        /* We add 11 spaces for ' (deleted)' to be appended */
-       temp = kmalloc(PATH_MAX + 11, GFP_TEMPORARY);
+       temp = kmalloc(PATH_MAX + 11, GFP_KERNEL);
        if (!temp)
                return kstrdup("<no_memory>", gfp);
 
index ace53a582be5918df67fce4409dd26f346a8e471..07a1d22807beb7cfb5f85c3343a5eacdc28fb523 100644 (file)
@@ -3685,7 +3685,7 @@ SYSCALL_DEFINE2(memfd_create,
        if (len > MFD_NAME_MAX_LEN + 1)
                return -EINVAL;
 
-       name = kmalloc(len + MFD_NAME_PREFIX_LEN, GFP_TEMPORARY);
+       name = kmalloc(len + MFD_NAME_PREFIX_LEN, GFP_KERNEL);
        if (!name)
                return -ENOMEM;
 
index d39a5d3834b31c0ab53d8d808c1224dbb2076a2a..163352c537ab63fb8dec4be269106c3100f86560 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4597,7 +4597,7 @@ static int list_locations(struct kmem_cache *s, char *buf,
        struct kmem_cache_node *n;
 
        if (!map || !alloc_loc_track(&t, PAGE_SIZE / sizeof(struct location),
-                                    GFP_TEMPORARY)) {
+                                    GFP_KERNEL)) {
                kfree(map);
                return sprintf(buf, "Out of memory\n");
        }
index a1497c516d85aaabc9cd6de476268f7fc7a4bdca..24ee68ecdd427b5c4a398a96c286006c56a04810 100644 (file)
@@ -627,7 +627,6 @@ static const struct {
        { "GFP_HIGHUSER_MOVABLE",       "HUM" },
        { "GFP_HIGHUSER",               "HU" },
        { "GFP_USER",                   "U" },
-       { "GFP_TEMPORARY",              "TMP" },
        { "GFP_KERNEL_ACCOUNT",         "KAC" },
        { "GFP_KERNEL",                 "K" },
        { "GFP_NOFS",                   "NF" },