Changeset c9670dd1 in rtems


Ignore:
Timestamp:
Jan 22, 2016, 11:11:02 PM (4 years ago)
Author:
Tetsuo Handa <penguin-kernel@…>
Branches:
master
Children:
1e6d56e
Parents:
410dd26
git-author:
Tetsuo Handa <penguin-kernel@…> (01/22/16 23:11:02)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/16/18 05:22:12)
Message:

tree wide: use kvfree() than conditional kfree()/vfree()

There are many locations that do

if (memory_was_allocated_by_vmalloc)

vfree(ptr);

else

kfree(ptr);

but kvfree() can handle both kmalloc()ed memory and vmalloc()ed memory
using is_vmalloc_addr(). Unless callers have special reasons, we can
replace this branch with kvfree(). Please check and reply if you found
problems.

Signed-off-by: Tetsuo Handa <penguin-kernel@…>
Acked-by: Michal Hocko <mhocko@…>
Acked-by: Jan Kara <jack@…>
Acked-by: Russell King <rmk+kernel@…>
Reviewed-by: Andreas Dilger <andreas.dilger@…>
Acked-by: "Rafael J. Wysocki" <rjw@…>
Acked-by: David Rientjes <rientjes@…>
Cc: "Luck, Tony" <tony.luck@…>
Cc: Oleg Drokin <oleg.drokin@…>
Cc: Boris Petkov <bp@…>
Signed-off-by: Andrew Morton <akpm@…>
Signed-off-by: Linus Torvalds <torvalds@…>

Location:
cpukit/libfs/src/jffs2
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/jffs2/include/linux/slab.h

    r410dd26 rc9670dd1  
    99#define kmalloc(x, y) malloc(x)
    1010#define kfree(x) free(x)
     11#define kvfree(x) free(x)
    1112#define vmalloc(x) malloc(x)
    1213#define vfree(x) free(x)
  • cpukit/libfs/src/jffs2/src/build.c

    r410dd26 rc9670dd1  
    2020#include <linux/vmalloc.h>
    2121#include <linux/mtd/mtd.h>
     22#include <linux/mm.h> /* kvfree() */
    2223#include "nodelist.h"
    2324
     
    386387
    387388 out_free:
    388 #ifndef __ECOS
    389         if (jffs2_blocks_use_vmalloc(c))
    390                 vfree(c->blocks);
    391         else
    392 #endif
    393                 kfree(c->blocks);
     389        kvfree(c->blocks);
    394390
    395391        return ret;
Note: See TracChangeset for help on using the changeset viewer.