diff mbox series

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

Message ID 1581951895-3038-1-git-send-email-qiwuchen55@gmail.com (mailing list archive)
State New, archived
Headers show
Series mm/slub.c: replace cpu_slab->partial with wrapped APIs | expand

Commit Message

chenqiwu Feb. 17, 2020, 3:04 p.m. UTC
From: chenqiwu <chenqiwu@xiaomi.com>

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.

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 mm/slub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Vlastimil Babka Feb. 26, 2020, 6:15 p.m. UTC | #1
On 2/17/20 4:04 PM, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
> 
> 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.
> 
> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>

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.

> ---
>  mm/slub.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 17dc00e..15bb0ba 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -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) {
>
Christoph Lameter (Ampere) Feb. 26, 2020, 6:26 p.m. UTC | #2
On Wed, 26 Feb 2020, Vlastimil Babka wrote:

> 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.
diff mbox series

Patch

diff --git a/mm/slub.c b/mm/slub.c
index 17dc00e..15bb0ba 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -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) {