Skip to content

Commit b9663a6

Browse files
author
Matthew Wilcox (Oracle)
committed
tools: Add kmem_cache_alloc_lru()
Turn kmem_cache_alloc() into a wrapper around kmem_cache_alloc_lru(). Fixes: 9bbdc0f ("xarray: use kmem_cache_alloc_lru to allocate xa_node") Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reported-by: Liam R. Howlett <Liam.Howlett@oracle.com> Reported-by: Li Wang <liwang@redhat.com>
1 parent 281b9d9 commit b9663a6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

tools/include/linux/slab.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ static inline void *kzalloc(size_t size, gfp_t gfp)
2828
return kmalloc(size, gfp | __GFP_ZERO);
2929
}
3030

31-
void *kmem_cache_alloc(struct kmem_cache *cachep, int flags);
31+
struct list_lru;
32+
33+
void *kmem_cache_alloc_lru(struct kmem_cache *cachep, struct list_lru *, int flags);
34+
static inline void *kmem_cache_alloc(struct kmem_cache *cachep, int flags)
35+
{
36+
return kmem_cache_alloc_lru(cachep, NULL, flags);
37+
}
3238
void kmem_cache_free(struct kmem_cache *cachep, void *objp);
3339

3440
struct kmem_cache *kmem_cache_create(const char *name, unsigned int size,

tools/testing/radix-tree/linux.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ struct kmem_cache {
2525
void (*ctor)(void *);
2626
};
2727

28-
void *kmem_cache_alloc(struct kmem_cache *cachep, int gfp)
28+
void *kmem_cache_alloc_lru(struct kmem_cache *cachep, struct list_lru *lru,
29+
int gfp)
2930
{
3031
void *p;
3132

0 commit comments

Comments
 (0)