Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-26 Thread Alex Shi
在 2020/11/26 下午11:55, Matthew Wilcox 写道: > On Thu, Nov 26, 2020 at 04:44:04PM +0100, Vlastimil Babka wrote: >> However, Matthew wanted to increase pagevec size [1] and once 15^2 becomes >> 63^2, it starts to be somewhat more worrying. >> >> [1] >> https://lore.kernel.org/linux-mm/20201105172651

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-26 Thread Matthew Wilcox
On Thu, Nov 26, 2020 at 04:44:04PM +0100, Vlastimil Babka wrote: > However, Matthew wanted to increase pagevec size [1] and once 15^2 becomes > 63^2, it starts to be somewhat more worrying. > > [1] > https://lore.kernel.org/linux-mm/20201105172651.2455-1-wi...@infradead.org/ Well, Tim wanted it

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-26 Thread Vlastimil Babka
On 11/26/20 12:22 PM, Vlastimil Babka wrote: On 11/26/20 8:24 AM, Yu Zhao wrote: On Thu, Nov 26, 2020 at 02:39:03PM +0800, Alex Shi wrote: 在 2020/11/26 下午12:52, Yu Zhao 写道: >> */ >> void __pagevec_lru_add(struct pagevec *pvec) >> { >> - int i; >> - struct lruvec *lruvec = NULL;

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-26 Thread Vlastimil Babka
On 11/26/20 8:24 AM, Yu Zhao wrote: On Thu, Nov 26, 2020 at 02:39:03PM +0800, Alex Shi wrote: 在 2020/11/26 下午12:52, Yu Zhao 写道: >> */ >> void __pagevec_lru_add(struct pagevec *pvec) >> { >> - int i; >> - struct lruvec *lruvec = NULL; >> + int i, nr_lruvec; >>unsigned

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-26 Thread Vlastimil Babka
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, an

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-26 Thread Alex Shi
在 2020/11/26 下午3:24, Yu Zhao 写道: > Oh, no, I'm not against your idea. I was saying it doesn't seem > necessary to sort -- a nested loop would just do the job given > pagevec is small. > > diff --git a/mm/swap.c b/mm/swap.c > index cb3794e13b48..1d238edc2907 100644 > --- a/mm/swap.c > +++ b/mm/s

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-25 Thread Yu Zhao
On Thu, Nov 26, 2020 at 02:39:03PM +0800, Alex Shi wrote: > > > 在 2020/11/26 下午12:52, Yu Zhao 写道: > >> */ > >> void __pagevec_lru_add(struct pagevec *pvec) > >> { > >> - int i; > >> - struct lruvec *lruvec = NULL; > >> + int i, nr_lruvec; > >>unsigned long flags = 0; > >> + struct pag

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-25 Thread Alex Shi
在 2020/11/26 下午12:52, Yu Zhao 写道: >> */ >> void __pagevec_lru_add(struct pagevec *pvec) >> { >> -int i; >> -struct lruvec *lruvec = NULL; >> +int i, nr_lruvec; >> unsigned long flags = 0; >> +struct page *page; >> +struct lruvecs lruvecs; >> >> -for (i = 0; i <

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-25 Thread Yu Zhao
On Fri, Nov 20, 2020 at 04:27:27PM +0800, 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 s

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-25 Thread Alex Shi
在 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 >>

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-25 Thread 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

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-22 Thread Alex Shi
在 2020/11/21 上午7:19, Andrew Morton 写道: > On Fri, 20 Nov 2020 16:27:27 +0800 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

Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add

2020-11-20 Thread Andrew Morton
On Fri, 20 Nov 2020 16:27:27 +0800 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 l