]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
slab, slub: use page->rcu_head instead of page->lru plus cast
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Wed, 21 Oct 2015 22:03:29 +0000 (09:03 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 Oct 2015 22:03:29 +0000 (09:03 +1100)
We have properly typed page->rcu_head, no need to cast page->lru.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/slab.c
mm/slub.c

index 881f8844f45b367b3d7435f77cf7a25231a022ae..2cf30e3124226ee8ab9482b0db8f07ad3b9c127c 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1888,21 +1888,10 @@ static void slab_destroy(struct kmem_cache *cachep, struct page *page)
 
        freelist = page->freelist;
        slab_destroy_debugcheck(cachep, page);
-       if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) {
-               struct rcu_head *head;
-
-               /*
-                * RCU free overloads the RCU head over the LRU.
-                * slab_page has been overloeaded over the LRU,
-                * however it is not used from now on so that
-                * we can use it safely.
-                */
-               head = (void *)&page->rcu_head;
-               call_rcu(head, kmem_rcu_free);
-
-       } else {
+       if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU))
+               call_rcu(&page->rcu_head, kmem_rcu_free);
+       else
                kmem_freepages(cachep, page);
-       }
 
        /*
         * From now on, we don't use freelist
index 6f0dda19db2a43169c6b98187469327f9d746d5d..c17c5202864d9f091b210eab4dd2eba2e426fcd4 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1549,10 +1549,7 @@ static void free_slab(struct kmem_cache *s, struct page *page)
                        VM_BUG_ON(s->reserved != sizeof(*head));
                        head = page_address(page) + offset;
                } else {
-                       /*
-                        * RCU free overloads the RCU head over the LRU
-                        */
-                       head = (void *)&page->lru;
+                       head = &page->rcu_head;
                }
 
                call_rcu(head, rcu_free_slab);