Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-10 Thread Huang, Ying
Dave Hansen writes: >> Yes. Boolean parameter isn't good at most times. Matthew Wilcox >> suggested to use >> >> swap_duplicate(, HPAGE_PMD_NR); >> >> vs. >> >> swap_duplicate(, 1); >> >> He thinks this makes the interface more flexible to support other swap >> entry size

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-10 Thread Huang, Ying
Dave Hansen writes: >> Yes. Boolean parameter isn't good at most times. Matthew Wilcox >> suggested to use >> >> swap_duplicate(, HPAGE_PMD_NR); >> >> vs. >> >> swap_duplicate(, 1); >> >> He thinks this makes the interface more flexible to support other swap >> entry size

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-10 Thread Dave Hansen
> Yes. Boolean parameter isn't good at most times. Matthew Wilcox > suggested to use > > swap_duplicate(, HPAGE_PMD_NR); > > vs. > > swap_duplicate(, 1); > > He thinks this makes the interface more flexible to support other swap > entry size in the future. What do you think

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-10 Thread Dave Hansen
> Yes. Boolean parameter isn't good at most times. Matthew Wilcox > suggested to use > > swap_duplicate(, HPAGE_PMD_NR); > > vs. > > swap_duplicate(, 1); > > He thinks this makes the interface more flexible to support other swap > entry size in the future. What do you think

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-10 Thread Huang, Ying
Dave Hansen writes: >> +static inline bool thp_swap_supported(void) >> +{ >> +return IS_ENABLED(CONFIG_THP_SWAP); >> +} > > This seems like rather useless abstraction. Why do we need it? I just want to make it shorter, 19 vs 27 characters. But if you think IS_ENABLED(CONFIG_THP_SWAP) is

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-10 Thread Huang, Ying
Dave Hansen writes: >> +static inline bool thp_swap_supported(void) >> +{ >> +return IS_ENABLED(CONFIG_THP_SWAP); >> +} > > This seems like rather useless abstraction. Why do we need it? I just want to make it shorter, 19 vs 27 characters. But if you think IS_ENABLED(CONFIG_THP_SWAP) is

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-09 Thread Dave Hansen
> +static inline bool thp_swap_supported(void) > +{ > + return IS_ENABLED(CONFIG_THP_SWAP); > +} This seems like rather useless abstraction. Why do we need it? ... > -static inline int swap_duplicate(swp_entry_t swp) > +static inline int swap_duplicate(swp_entry_t *swp, bool cluster) > { >

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-09 Thread Dave Hansen
> +static inline bool thp_swap_supported(void) > +{ > + return IS_ENABLED(CONFIG_THP_SWAP); > +} This seems like rather useless abstraction. Why do we need it? ... > -static inline int swap_duplicate(swp_entry_t swp) > +static inline int swap_duplicate(swp_entry_t *swp, bool cluster) > { >

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-09 Thread Huang, Ying
Dan Williams writes: > On Thu, Jun 21, 2018 at 8:55 PM Huang, Ying wrote: >> >> From: Huang Ying >> >> To support to swapin the THP as a whole, we need to create PMD swap >> mapping during swapout, and maintain PMD swap mapping count. This >> patch implements the support to increase the PMD

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-09 Thread Huang, Ying
Dan Williams writes: > On Thu, Jun 21, 2018 at 8:55 PM Huang, Ying wrote: >> >> From: Huang Ying >> >> To support to swapin the THP as a whole, we need to create PMD swap >> mapping during swapout, and maintain PMD swap mapping count. This >> patch implements the support to increase the PMD

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-07 Thread Dan Williams
On Thu, Jun 21, 2018 at 8:55 PM Huang, Ying wrote: > > From: Huang Ying > > To support to swapin the THP as a whole, we need to create PMD swap > mapping during swapout, and maintain PMD swap mapping count. This > patch implements the support to increase the PMD swap mapping > count (for

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-07 Thread Dan Williams
On Thu, Jun 21, 2018 at 8:55 PM Huang, Ying wrote: > > From: Huang Ying > > To support to swapin the THP as a whole, we need to create PMD swap > mapping during swapout, and maintain PMD swap mapping count. This > patch implements the support to increase the PMD swap mapping > count (for

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-01 Thread Huang, Ying
Matthew Wilcox writes: > On Fri, Jun 22, 2018 at 11:51:33AM +0800, Huang, Ying wrote: >> +++ b/mm/swap_state.c >> @@ -433,7 +433,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, >> gfp_t gfp_mask, >> /* >> * Swap entry may have been freed since our caller

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-07-01 Thread Huang, Ying
Matthew Wilcox writes: > On Fri, Jun 22, 2018 at 11:51:33AM +0800, Huang, Ying wrote: >> +++ b/mm/swap_state.c >> @@ -433,7 +433,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, >> gfp_t gfp_mask, >> /* >> * Swap entry may have been freed since our caller

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-06-29 Thread Matthew Wilcox
On Fri, Jun 22, 2018 at 11:51:33AM +0800, Huang, Ying wrote: > +++ b/mm/swap_state.c > @@ -433,7 +433,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, > gfp_t gfp_mask, > /* >* Swap entry may have been freed since our caller observed it. >

Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-06-29 Thread Matthew Wilcox
On Fri, Jun 22, 2018 at 11:51:33AM +0800, Huang, Ying wrote: > +++ b/mm/swap_state.c > @@ -433,7 +433,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, > gfp_t gfp_mask, > /* >* Swap entry may have been freed since our caller observed it. >

[PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-06-21 Thread Huang, Ying
From: Huang Ying To support to swapin the THP as a whole, we need to create PMD swap mapping during swapout, and maintain PMD swap mapping count. This patch implements the support to increase the PMD swap mapping count (for swapout, fork, etc.) and set SWAP_HAS_CACHE flag (for swapin, etc.)

[PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

2018-06-21 Thread Huang, Ying
From: Huang Ying To support to swapin the THP as a whole, we need to create PMD swap mapping during swapout, and maintain PMD swap mapping count. This patch implements the support to increase the PMD swap mapping count (for swapout, fork, etc.) and set SWAP_HAS_CACHE flag (for swapin, etc.)