Commit b5568280 authored by Christoph Lameter's avatar Christoph Lameter Committed by Pekka Enberg

slob: Remove various small accessors

Those have become so simple that they are no longer needed.
Reviewed-by: default avatarJoonsoo Kim <js1304@gmail.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
signed-off-by: default avatarChristoph Lameter <cl@linux.com>
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
parent 690d5777
...@@ -91,14 +91,6 @@ struct slob_block { ...@@ -91,14 +91,6 @@ struct slob_block {
}; };
typedef struct slob_block slob_t; typedef struct slob_block slob_t;
/*
* free_slob_page: call before a slob_page is returned to the page allocator.
*/
static inline void free_slob_page(struct page *sp)
{
reset_page_mapcount(sp);
}
/* /*
* All partially free slob pages go on these lists. * All partially free slob pages go on these lists.
*/ */
...@@ -108,29 +100,6 @@ static LIST_HEAD(free_slob_small); ...@@ -108,29 +100,6 @@ static LIST_HEAD(free_slob_small);
static LIST_HEAD(free_slob_medium); static LIST_HEAD(free_slob_medium);
static LIST_HEAD(free_slob_large); static LIST_HEAD(free_slob_large);
/*
* is_slob_page: True for all slob pages (false for bigblock pages)
*/
static inline int is_slob_page(struct page *sp)
{
return PageSlab(sp);
}
static inline void set_slob_page(struct page *sp)
{
__SetPageSlab(sp);
}
static inline void clear_slob_page(struct page *sp)
{
__ClearPageSlab(sp);
}
static inline struct page *slob_page(const void *addr)
{
return virt_to_page(addr);
}
/* /*
* slob_page_free: true for pages on free_slob_pages list. * slob_page_free: true for pages on free_slob_pages list.
*/ */
...@@ -347,8 +316,8 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node) ...@@ -347,8 +316,8 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
b = slob_new_pages(gfp & ~__GFP_ZERO, 0, node); b = slob_new_pages(gfp & ~__GFP_ZERO, 0, node);
if (!b) if (!b)
return NULL; return NULL;
sp = slob_page(b); sp = virt_to_page(b);
set_slob_page(sp); __SetPageSlab(sp);
spin_lock_irqsave(&slob_lock, flags); spin_lock_irqsave(&slob_lock, flags);
sp->units = SLOB_UNITS(PAGE_SIZE); sp->units = SLOB_UNITS(PAGE_SIZE);
...@@ -380,7 +349,7 @@ static void slob_free(void *block, int size) ...@@ -380,7 +349,7 @@ static void slob_free(void *block, int size)
return; return;
BUG_ON(!size); BUG_ON(!size);
sp = slob_page(block); sp = virt_to_page(block);
units = SLOB_UNITS(size); units = SLOB_UNITS(size);
spin_lock_irqsave(&slob_lock, flags); spin_lock_irqsave(&slob_lock, flags);
...@@ -390,8 +359,8 @@ static void slob_free(void *block, int size) ...@@ -390,8 +359,8 @@ static void slob_free(void *block, int size)
if (slob_page_free(sp)) if (slob_page_free(sp))
clear_slob_page_free(sp); clear_slob_page_free(sp);
spin_unlock_irqrestore(&slob_lock, flags); spin_unlock_irqrestore(&slob_lock, flags);
clear_slob_page(sp); __ClearPageSlab(sp);
free_slob_page(sp); reset_page_mapcount(sp);
slob_free_pages(b, 0); slob_free_pages(b, 0);
return; return;
} }
...@@ -508,8 +477,8 @@ void kfree(const void *block) ...@@ -508,8 +477,8 @@ void kfree(const void *block)
return; return;
kmemleak_free(block); kmemleak_free(block);
sp = slob_page(block); sp = virt_to_page(block);
if (is_slob_page(sp)) { if (PageSlab(sp)) {
int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
unsigned int *m = (unsigned int *)(block - align); unsigned int *m = (unsigned int *)(block - align);
slob_free(m, *m + align); slob_free(m, *m + align);
...@@ -527,8 +496,8 @@ size_t ksize(const void *block) ...@@ -527,8 +496,8 @@ size_t ksize(const void *block)
if (unlikely(block == ZERO_SIZE_PTR)) if (unlikely(block == ZERO_SIZE_PTR))
return 0; return 0;
sp = slob_page(block); sp = virt_to_page(block);
if (is_slob_page(sp)) { if (PageSlab(sp)) {
int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
unsigned int *m = (unsigned int *)(block - align); unsigned int *m = (unsigned int *)(block - align);
return SLOB_UNITS(*m) * SLOB_UNIT; return SLOB_UNITS(*m) * SLOB_UNIT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment