Revert "ANDROID: mm: add get_each_object_track function"
This reverts commit 1fb8e678a5.
It causes build errors in 5.15-rc1 and there are no in-kernel users of
this api so remove it. If it is needed, someone can easily add a
working version of it back.
Bug: 177377077
Cc: Vijayanand Jitta <vjitta@codeaurora.org>
Cc: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I74fe57124b74e9695636d139b1f548b69fbc9039
This commit is contained in:
31
mm/slab.h
31
mm/slab.h
@@ -91,24 +91,6 @@ struct kmem_cache *kmalloc_slab(size_t, gfp_t);
|
|||||||
|
|
||||||
gfp_t kmalloc_fix_flags(gfp_t flags);
|
gfp_t kmalloc_fix_flags(gfp_t flags);
|
||||||
|
|
||||||
#ifdef CONFIG_SLUB
|
|
||||||
/*
|
|
||||||
* Tracking user of a slab.
|
|
||||||
*/
|
|
||||||
#define TRACK_ADDRS_COUNT 16
|
|
||||||
struct track {
|
|
||||||
unsigned long addr; /* Called from address */
|
|
||||||
#ifdef CONFIG_STACKTRACE
|
|
||||||
unsigned long addrs[TRACK_ADDRS_COUNT]; /* Called from address */
|
|
||||||
#endif
|
|
||||||
int cpu; /* Was running on cpu */
|
|
||||||
int pid; /* Pid context */
|
|
||||||
unsigned long when; /* When did the operation occur */
|
|
||||||
};
|
|
||||||
|
|
||||||
enum track_item { TRACK_ALLOC, TRACK_FREE };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Functions provided by the slab allocators */
|
/* Functions provided by the slab allocators */
|
||||||
int __kmem_cache_create(struct kmem_cache *, slab_flags_t flags);
|
int __kmem_cache_create(struct kmem_cache *, slab_flags_t flags);
|
||||||
|
|
||||||
@@ -234,10 +216,6 @@ DECLARE_STATIC_KEY_FALSE(slub_debug_enabled);
|
|||||||
#endif
|
#endif
|
||||||
extern void print_tracking(struct kmem_cache *s, void *object);
|
extern void print_tracking(struct kmem_cache *s, void *object);
|
||||||
long validate_slab_cache(struct kmem_cache *s);
|
long validate_slab_cache(struct kmem_cache *s);
|
||||||
extern unsigned long get_each_object_track(struct kmem_cache *s,
|
|
||||||
struct page *page, enum track_item alloc,
|
|
||||||
int (*fn)(const struct kmem_cache *, const void *,
|
|
||||||
const struct track *, void *), void *private);
|
|
||||||
static inline bool __slub_debug_enabled(void)
|
static inline bool __slub_debug_enabled(void)
|
||||||
{
|
{
|
||||||
return static_branch_unlikely(&slub_debug_enabled);
|
return static_branch_unlikely(&slub_debug_enabled);
|
||||||
@@ -246,15 +224,6 @@ static inline bool __slub_debug_enabled(void)
|
|||||||
static inline void print_tracking(struct kmem_cache *s, void *object)
|
static inline void print_tracking(struct kmem_cache *s, void *object)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_SLUB
|
|
||||||
static inline unsigned long get_each_object_track(struct kmem_cache *s,
|
|
||||||
struct page *page, enum track_item alloc,
|
|
||||||
int (*fn)(const struct kmem_cache *, const void *,
|
|
||||||
const struct track *, void *), void *private)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
static inline bool __slub_debug_enabled(void)
|
static inline bool __slub_debug_enabled(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
49
mm/slub.c
49
mm/slub.c
@@ -200,6 +200,22 @@ static inline bool kmem_cache_has_cpu_partial(struct kmem_cache *s)
|
|||||||
/* Use cmpxchg_double */
|
/* Use cmpxchg_double */
|
||||||
#define __CMPXCHG_DOUBLE ((slab_flags_t __force)0x40000000U)
|
#define __CMPXCHG_DOUBLE ((slab_flags_t __force)0x40000000U)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tracking user of a slab.
|
||||||
|
*/
|
||||||
|
#define TRACK_ADDRS_COUNT 16
|
||||||
|
struct track {
|
||||||
|
unsigned long addr; /* Called from address */
|
||||||
|
#ifdef CONFIG_STACKTRACE
|
||||||
|
unsigned long addrs[TRACK_ADDRS_COUNT]; /* Called from address */
|
||||||
|
#endif
|
||||||
|
int cpu; /* Was running on cpu */
|
||||||
|
int pid; /* Pid context */
|
||||||
|
unsigned long when; /* When did the operation occur */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum track_item { TRACK_ALLOC, TRACK_FREE };
|
||||||
|
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
static int sysfs_slab_add(struct kmem_cache *);
|
static int sysfs_slab_add(struct kmem_cache *);
|
||||||
static int sysfs_slab_alias(struct kmem_cache *, const char *);
|
static int sysfs_slab_alias(struct kmem_cache *, const char *);
|
||||||
@@ -595,39 +611,6 @@ static struct track *get_track(struct kmem_cache *s, void *object,
|
|||||||
return kasan_reset_tag(p + alloc);
|
return kasan_reset_tag(p + alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This function will be used to loop through all the slab objects in
|
|
||||||
* a page to give track structure for each object, the function fn will
|
|
||||||
* be using this track structure and extract required info into its private
|
|
||||||
* data, the return value will be the number of track structures that are
|
|
||||||
* processed.
|
|
||||||
*/
|
|
||||||
unsigned long get_each_object_track(struct kmem_cache *s,
|
|
||||||
struct page *page, enum track_item alloc,
|
|
||||||
int (*fn)(const struct kmem_cache *, const void *,
|
|
||||||
const struct track *, void *), void *private)
|
|
||||||
{
|
|
||||||
void *p;
|
|
||||||
struct track *t;
|
|
||||||
int ret;
|
|
||||||
unsigned long num_track = 0;
|
|
||||||
|
|
||||||
if (!slub_debug || !(s->flags & SLAB_STORE_USER))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
slab_lock(page);
|
|
||||||
for_each_object(p, s, page_address(page), page->objects) {
|
|
||||||
t = get_track(s, p, alloc);
|
|
||||||
ret = fn(s, p, t, private);
|
|
||||||
if (ret < 0)
|
|
||||||
break;
|
|
||||||
num_track += 1;
|
|
||||||
}
|
|
||||||
slab_unlock(page);
|
|
||||||
return num_track;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(get_each_object_track);
|
|
||||||
|
|
||||||
static void set_track(struct kmem_cache *s, void *object,
|
static void set_track(struct kmem_cache *s, void *object,
|
||||||
enum track_item alloc, unsigned long addr)
|
enum track_item alloc, unsigned long addr)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user