diff options
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -614,20 +614,19 @@ static inline void page_set_slab(struct page *page, struct slab *slab) | |||
614 | 614 | ||
615 | static inline struct slab *page_get_slab(struct page *page) | 615 | static inline struct slab *page_get_slab(struct page *page) |
616 | { | 616 | { |
617 | page = compound_head(page); | ||
618 | BUG_ON(!PageSlab(page)); | 617 | BUG_ON(!PageSlab(page)); |
619 | return (struct slab *)page->lru.prev; | 618 | return (struct slab *)page->lru.prev; |
620 | } | 619 | } |
621 | 620 | ||
622 | static inline struct kmem_cache *virt_to_cache(const void *obj) | 621 | static inline struct kmem_cache *virt_to_cache(const void *obj) |
623 | { | 622 | { |
624 | struct page *page = virt_to_page(obj); | 623 | struct page *page = virt_to_head_page(obj); |
625 | return page_get_cache(page); | 624 | return page_get_cache(page); |
626 | } | 625 | } |
627 | 626 | ||
628 | static inline struct slab *virt_to_slab(const void *obj) | 627 | static inline struct slab *virt_to_slab(const void *obj) |
629 | { | 628 | { |
630 | struct page *page = virt_to_page(obj); | 629 | struct page *page = virt_to_head_page(obj); |
631 | return page_get_slab(page); | 630 | return page_get_slab(page); |
632 | } | 631 | } |
633 | 632 | ||
@@ -2876,7 +2875,7 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp, | |||
2876 | 2875 | ||
2877 | objp -= obj_offset(cachep); | 2876 | objp -= obj_offset(cachep); |
2878 | kfree_debugcheck(objp); | 2877 | kfree_debugcheck(objp); |
2879 | page = virt_to_page(objp); | 2878 | page = virt_to_head_page(objp); |
2880 | 2879 | ||
2881 | slabp = page_get_slab(page); | 2880 | slabp = page_get_slab(page); |
2882 | 2881 | ||
@@ -3100,7 +3099,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, | |||
3100 | struct slab *slabp; | 3099 | struct slab *slabp; |
3101 | unsigned objnr; | 3100 | unsigned objnr; |
3102 | 3101 | ||
3103 | slabp = page_get_slab(virt_to_page(objp)); | 3102 | slabp = page_get_slab(virt_to_head_page(objp)); |
3104 | objnr = (unsigned)(objp - slabp->s_mem) / cachep->buffer_size; | 3103 | objnr = (unsigned)(objp - slabp->s_mem) / cachep->buffer_size; |
3105 | slab_bufctl(slabp)[objnr] = BUFCTL_ACTIVE; | 3104 | slab_bufctl(slabp)[objnr] = BUFCTL_ACTIVE; |
3106 | } | 3105 | } |