Skip to contentSkip to conversation

mm/slub.c: replace cpu_slab->partial with wrapped APIs

PATCH Applied [email protected] 3 participants 3 messages Feb 17, 2020 – Feb 26, 2020

Subsystems (2)

v1 of 2 Applied 1/1 Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/slub.c: replace cpu_slab->partial with wrapped APIs

From: chenqiwu <[email protected]>

There are slub_percpu_partial() and slub_set_percpu_partial() APIs to wrap kmem_cache->cpu_partial. This patch will use the two to replace cpu_slab->partial in slub code.

---
 mm/slub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/slub.c +2 -2
index 17dc00e..15bb0ba 100644
@@ -2207,11 +2207,11 @@ static void unfreeze_partials(struct kmem_cache *s,
 	struct kmem_cache_node *n = NULL, *n2 = NULL;
 	struct page *page, *discard_page = NULL;
 
-	while ((page = c->partial)) {
+	while ((page = slub_percpu_partial(c))) {
 		struct page new;
 		struct page old;
 
-		c->partial = page->next;
+		slub_set_percpu_partial(c, page);
 
 		n2 = get_node(s, page_to_nid(page));
 		if (n != n2) {
Signature · 1 line
1.9.1
#1 lore raw
Quoted 7 lines · On 2/17/20 4:04 PM, [email protected] wrote:

From: chenqiwu <[email protected]>

There are slub_percpu_partial() and slub_set_percpu_partial() APIs to wrap kmem_cache->cpu_partial. This patch will use the two to replace cpu_slab->partial in slub code.

Same comment as for "[PATCH v2] mm/slub.c: replace kmem_cache->cpu_partial with wrapped APIs". This function generates code only with CONFIG_SLUB_CPU_PARTIAL and so the wrapper just obfuscates the code unnecessarily.

Quoted 23 lines
---
 mm/slub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/slub.c +2 -2
index 17dc00e..15bb0ba 100644
@@ -2207,11 +2207,11 @@ static void unfreeze_partials(struct kmem_cache *s,
 	struct kmem_cache_node *n = NULL, *n2 = NULL;
 	struct page *page, *discard_page = NULL;
 
-	while ((page = c->partial)) {
+	while ((page = slub_percpu_partial(c))) {
 		struct page new;
 		struct page old;
 
-		c->partial = page->next;
+		slub_set_percpu_partial(c, page);
 
 		n2 = get_node(s, page_to_nid(page));
 		if (n != n2) {
#2 lore raw
Quoted 3 lines · Vlastimil Babka

Same comment as for "[PATCH v2] mm/slub.c: replace kmem_cache->cpu_partial with wrapped APIs". This function generates code only with CONFIG_SLUB_CPU_PARTIAL and so the wrapper just obfuscates the code unnecessarily.

I agree. Lets drop this.