[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a6d5613c-2fb7-15fe-a5cc-74e2453c3e21@suse.cz>
Date: Thu, 26 Nov 2020 12:05:28 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Alex Shi <alex.shi@...ux.alibaba.com>
Cc: Konstantin Khlebnikov <koct9i@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Hugh Dickins <hughd@...gle.com>, Yu Zhao <yuzhao@...gle.com>,
Michal Hocko <mhocko@...e.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add
On 11/26/20 4:12 AM, Alex Shi wrote:
>
>
> 在 2020/11/25 下午11:38, Vlastimil Babka 写道:
>> On 11/20/20 9:27 AM, Alex Shi wrote:
>>> The current relock logical will change lru_lock when found a new
>>> lruvec, so if 2 memcgs are reading file or alloc page at same time,
>>> they could hold the lru_lock alternately, and wait for each other for
>>> fairness attribute of ticket spin lock.
>>>
>>> This patch will sort that all lru_locks and only hold them once in
>>> above scenario. That could reduce fairness waiting for lock reget.
>>> Than, vm-scalability/case-lru-file-readtwice could get ~5% performance
>>> gain on my 2P*20core*HT machine.
>>
>> Hm, once you sort the pages like this, it's a shame not to splice them instead of more list_del() + list_add() iterations. update_lru_size() could be also called once?
>
> Yes, looks it's a good idea to use splice instead of list_del/add, but pages
> may on different lru list in a same lruvec, and also may come from different
> zones. That could involve 5 cycles for different lists, and more for zones...
Hmm, zones wouldn't affect splicing (there's a per-node lru these days), but
would affect accounting. And yeah, there are 5 lru lists, and we probably need
to be under lru lock to stabilize where a page belongs, so pre-sorting without
lock wouldn't be safe? Bummer.
> I give up the try.
>
Powered by blists - more mailing lists