Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-20 Thread Yang Shi
[ check_move_unevictable_pages() seems weird. It gets a pagevec from find_get_entries(), which, if I understand the THP page cache code correctly, might contain the same compound page over and over. It'll be !unevictable after the first iteration, so will only run once. So it produc

Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-20 Thread Yang Shi
On 5/20/19 5:43 PM, Yang Shi wrote: On 5/16/19 11:10 PM, Johannes Weiner wrote: On Tue, May 14, 2019 at 01:44:35PM -0700, Yang Shi wrote: On 5/13/19 11:20 PM, Michal Hocko wrote: On Mon 13-05-19 21:36:59, Yang Shi wrote: On Mon, May 13, 2019 at 2:45 PM Michal Hocko wrote: On Mon 13-05-

Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-20 Thread Yang Shi
On 5/16/19 11:10 PM, Johannes Weiner wrote: On Tue, May 14, 2019 at 01:44:35PM -0700, Yang Shi wrote: On 5/13/19 11:20 PM, Michal Hocko wrote: On Mon 13-05-19 21:36:59, Yang Shi wrote: On Mon, May 13, 2019 at 2:45 PM Michal Hocko wrote: On Mon 13-05-19 14:09:59, Yang Shi wrote: [...] I t

Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-16 Thread Johannes Weiner
On Tue, May 14, 2019 at 01:44:35PM -0700, Yang Shi wrote: > On 5/13/19 11:20 PM, Michal Hocko wrote: > > On Mon 13-05-19 21:36:59, Yang Shi wrote: > > > On Mon, May 13, 2019 at 2:45 PM Michal Hocko wrote: > > > > On Mon 13-05-19 14:09:59, Yang Shi wrote: > > > > [...] > > > > > I think we can just

Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-14 Thread Yang Shi
On 5/13/19 11:20 PM, Michal Hocko wrote: On Mon 13-05-19 21:36:59, Yang Shi wrote: On Mon, May 13, 2019 at 2:45 PM Michal Hocko wrote: On Mon 13-05-19 14:09:59, Yang Shi wrote: [...] I think we can just account 512 base pages for nr_scanned for isolate_lru_pages() to make the counters sane

Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-13 Thread Michal Hocko
On Mon 13-05-19 21:36:59, Yang Shi wrote: > On Mon, May 13, 2019 at 2:45 PM Michal Hocko wrote: > > > > On Mon 13-05-19 14:09:59, Yang Shi wrote: > > [...] > > > I think we can just account 512 base pages for nr_scanned for > > > isolate_lru_pages() to make the counters sane since PGSCAN_KSWAPD/DI

Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-13 Thread Yang Shi
On Mon, May 13, 2019 at 2:45 PM Michal Hocko wrote: > > On Mon 13-05-19 14:09:59, Yang Shi wrote: > [...] > > I think we can just account 512 base pages for nr_scanned for > > isolate_lru_pages() to make the counters sane since PGSCAN_KSWAPD/DIRECT > > just use it. > > > > And, sc->nr_scanned shou

Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-13 Thread Michal Hocko
On Mon 13-05-19 14:09:59, Yang Shi wrote: [...] > I think we can just account 512 base pages for nr_scanned for > isolate_lru_pages() to make the counters sane since PGSCAN_KSWAPD/DIRECT > just use it. > > And, sc->nr_scanned should be accounted as 512 base pages too otherwise we > may have nr_sca

Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-13 Thread Yang Shi
On 5/13/19 1:09 AM, Michal Hocko wrote: On Sat 11-05-19 00:23:40, Yang Shi wrote: Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after swapped out"), THP can be swapped out in a whole. But, nr_reclaimed still gets inc'ed by one even though a whole THP (512 pages) gets swapped

Re: [v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-13 Thread Michal Hocko
On Sat 11-05-19 00:23:40, Yang Shi wrote: > Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after > swapped out"), THP can be swapped out in a whole. But, nr_reclaimed > still gets inc'ed by one even though a whole THP (512 pages) gets > swapped out. > > This doesn't make too much

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-11 Thread William Kucharski
> On May 10, 2019, at 10:36 AM, Matthew Wilcox wrote: > > Please don't. That embeds the knowledge that we can only swap out either > normal pages or THP sized pages. I'm trying to make the VM capable of > supporting arbitrary-order pages, and this would be just one more place > to fix. >

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Yafang Shao
On Sat, May 11, 2019 at 12:36 AM Matthew Wilcox wrote: > > On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote: > > > + nr_reclaimed += (1 << compound_order(page)); > > > > How about to change this to > > > > > > nr_reclaimed += hpage_nr_pages(page); > > Please don't. Th

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Matthew Wilcox
On Fri, May 10, 2019 at 03:54:56PM -0700, Ira Weiny wrote: > On Fri, May 10, 2019 at 09:36:12AM -0700, Matthew Wilcox wrote: > > On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote: > > > > + nr_reclaimed += (1 << compound_order(page)); > > > > > > How about to change this to

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Ira Weiny
On Fri, May 10, 2019 at 09:36:12AM -0700, Matthew Wilcox wrote: > On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote: > > > + nr_reclaimed += (1 << compound_order(page)); > > > > How about to change this to > > > > > > nr_reclaimed += hpage_nr_pages(page); > > Please do

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Yang Shi
On 5/10/19 9:52 AM, Matthew Wilcox wrote: On Fri, May 10, 2019 at 09:50:04AM -0700, Yang Shi wrote: On 5/10/19 9:36 AM, Matthew Wilcox wrote: On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote: + nr_reclaimed += (1 << compound_order(page)); How about to change this t

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Matthew Wilcox
On Fri, May 10, 2019 at 09:50:04AM -0700, Yang Shi wrote: > On 5/10/19 9:36 AM, Matthew Wilcox wrote: > > On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote: > > > > + nr_reclaimed += (1 << compound_order(page)); > > > How about to change this to > > > > > > nr_recl

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Yang Shi
On 5/10/19 9:36 AM, Matthew Wilcox wrote: On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote: + nr_reclaimed += (1 << compound_order(page)); How about to change this to nr_reclaimed += hpage_nr_pages(page); Please don't. That embeds the knowledge that we c

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Matthew Wilcox
On Fri, May 10, 2019 at 10:12:40AM +0800, Huang, Ying wrote: > > + nr_reclaimed += (1 << compound_order(page)); > > How about to change this to > > > nr_reclaimed += hpage_nr_pages(page); Please don't. That embeds the knowledge that we can only swap out either normal pages o

[v2 PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Yang Shi
Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after swapped out"), THP can be swapped out in a whole. But, nr_reclaimed still gets inc'ed by one even though a whole THP (512 pages) gets swapped out. This doesn't make too much sense to memory reclaim. For example, direct reclaim

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Yang Shi
On 5/9/19 9:33 PM, William Kucharski wrote: On May 9, 2019, at 9:03 PM, Huang, Ying wrote: Yang Shi writes: On 5/9/19 7:12 PM, Huang, Ying wrote: How about to change this to nr_reclaimed += hpage_nr_pages(page); Either is fine to me. Is this faster than "1 << compound_order

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-10 Thread Yang Shi
On 5/9/19 8:03 PM, Huang, Ying wrote: Yang Shi writes: On 5/9/19 7:12 PM, Huang, Ying wrote: Yang Shi writes: Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after swapped out"), THP can be swapped out in a whole. But, nr_reclaimed still gets inc'ed by one even though a

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-09 Thread William Kucharski
> On May 9, 2019, at 9:03 PM, Huang, Ying wrote: > > Yang Shi writes: > >> On 5/9/19 7:12 PM, Huang, Ying wrote: >>> >>> How about to change this to >>> >>> >>> nr_reclaimed += hpage_nr_pages(page); >> >> Either is fine to me. Is this faster than "1 << compound_order(page)"? > >

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-09 Thread Huang, Ying
Yang Shi writes: > On 5/9/19 7:12 PM, Huang, Ying wrote: >> Yang Shi writes: >> >>> Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after >>> swapped out"), THP can be swapped out in a whole. But, nr_reclaimed >>> still gets inc'ed by one even though a whole THP (512 pages) gets

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-09 Thread Yang Shi
On 5/9/19 7:12 PM, Huang, Ying wrote: Yang Shi writes: Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after swapped out"), THP can be swapped out in a whole. But, nr_reclaimed still gets inc'ed by one even though a whole THP (512 pages) gets swapped out. This doesn't make

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-09 Thread Huang, Ying
Yang Shi writes: > Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after > swapped out"), THP can be swapped out in a whole. But, nr_reclaimed > still gets inc'ed by one even though a whole THP (512 pages) gets > swapped out. > > This doesn't make too much sense to memory reclaim.

Re: [PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-09 Thread Shakeel Butt
From: Yang Shi Date: Thu, May 9, 2019 at 5:16 PM To: , , , , , , Cc: , , > Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after > swapped out"), THP can be swapped out in a whole. But, nr_reclaimed > still gets inc'ed by one even though a whole THP (512 pages) gets > swapped ou

[PATCH] mm: vmscan: correct nr_reclaimed for THP

2019-05-09 Thread Yang Shi
Since commit bd4c82c22c36 ("mm, THP, swap: delay splitting THP after swapped out"), THP can be swapped out in a whole. But, nr_reclaimed still gets inc'ed by one even though a whole THP (512 pages) gets swapped out. This doesn't make too much sense to memory reclaim. For example, direct reclaim