linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Johannes Weiner <hannes@cmpxchg.org>,
	Jingxiang Zeng <jingxiangzeng.cas@gmail.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@kernel.org,
	roman.gushchin@linux.dev, shakeel.butt@linux.dev,
	david@redhat.com, muchun.song@linux.dev,
	chengming.zhou@linux.dev, kasong@tencent.com, lkp@intel.com,
	Zeng Jingxiang <linuszeng@tencent.com>
Subject: Re: [PATCH] mm/list_lru: allocate on first insert instead of allocation
Date: Fri, 28 Feb 2025 18:18:05 +0100	[thread overview]
Message-ID: <e9adf6e8-d373-4429-8f4b-1e0b41c5df58@suse.cz> (raw)
In-Reply-To: <20250228163437.GA120597@cmpxchg.org>

On 2/28/25 17:34, Johannes Weiner wrote:
> On Fri, Feb 28, 2025 at 07:38:36PM +0800, Jingxiang Zeng wrote:
>> @@ -84,6 +86,9 @@ lock_list_lru_of_memcg(struct list_lru *lru, int nid, struct mem_cgroup *memcg,
>>  			spin_unlock_irq(&l->lock);
>>  		else
>>  			spin_unlock(&l->lock);
>> +	} else {
>> +		if (!memcg_list_lru_alloc(memcg, lru))
>> +			goto again;
>>  	}
> 
> Unfortunately, you can't do allocations from this path :(
> 
> list_lru_add() is called from many places with spinlocks, rcu locks
> etc. held.

Aww, I was hoping we'd get rid of all the plumbing of lru through the slab
allocator.
But maybe we could, anyway? In __memcg_slab_post_alloc_hook() AFAICS the
only part that lru handling reuses is the objcg pointer. Moving the code to
kmem_cache_alloc_lru() would mean just another current_obj_cgroup() lookup
and that's not that expensive in the likely() cases, or is it?



  reply	other threads:[~2025-02-28 17:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 11:38 Jingxiang Zeng
2025-02-28 16:34 ` Johannes Weiner
2025-02-28 17:18   ` Vlastimil Babka [this message]
2025-02-28 22:05     ` Vlastimil Babka
2025-03-01 18:32 ` Vlastimil Babka
2025-03-03  4:58   ` Kairui Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9adf6e8-d373-4429-8f4b-1e0b41c5df58@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=jingxiangzeng.cas@gmail.com \
    --cc=kasong@tencent.com \
    --cc=linuszeng@tencent.com \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox