Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1224978 > unrolled thread

[PATCHv6 2/7] slab, slub: use page->rcu_head instead of page->lru plus cast

Started by"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
First post2015-09-15 12:30 +0200
Last post2015-09-15 20:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCHv6 2/7] slab, slub: use page->rcu_head instead of page->lru plus cast "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2015-09-15 12:30 +0200
    Re: [PATCHv6 2/7] slab, slub: use page->rcu_head instead of page->lru  plus cast Christoph Lameter <cl@linux.com> - 2015-09-15 20:40 +0200

#1224978 — [PATCHv6 2/7] slab, slub: use page->rcu_head instead of page->lru plus cast

From"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date2015-09-15 12:30 +0200
Subject[PATCHv6 2/7] slab, slub: use page->rcu_head instead of page->lru plus cast
Message-ID<q8VER-21d-15@gated-at.bofh.it>
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>
Cc: Christoph Lameter <cl@linux.com>
---
 mm/slab.c | 17 +++--------------
 mm/slub.c |  5 +----
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index c77ebe6cc87c..90ba9170e0c3 100644
--- 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
diff --git a/mm/slub.c b/mm/slub.c
index f614b5dc396b..6b6e771df1c7 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1507,10 +1507,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);
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1225500 — Re: [PATCHv6 2/7] slab, slub: use page->rcu_head instead of page->lru plus cast

FromChristoph Lameter <cl@linux.com>
Date2015-09-15 20:40 +0200
SubjectRe: [PATCHv6 2/7] slab, slub: use page->rcu_head instead of page->lru plus cast
Message-ID<q93j3-4zy-15@gated-at.bofh.it>
In reply to#1224978
On Tue, 15 Sep 2015, Kirill A. Shutemov wrote:

> We have properly typed page->rcu_head, no need to cast page->lru.

Acked-by: Christoph Lameter <cl@linux.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web