Re: [PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-18 Thread Huang, Ying
Dave Hansen writes: > On 07/17/2018 08:25 PM, Huang, Ying wrote: >>> Seriously, though, does it hurt us to add a comment or two to say >>> something like: >>> >>> /* >>> * Should not even be attempting cluster allocations when >>> * huge page swap is disabled. Warn and fail the

Re: [PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-18 Thread Huang, Ying
Dave Hansen writes: > On 07/17/2018 08:25 PM, Huang, Ying wrote: >>> Seriously, though, does it hurt us to add a comment or two to say >>> something like: >>> >>> /* >>> * Should not even be attempting cluster allocations when >>> * huge page swap is disabled. Warn and fail the

Re: [PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-18 Thread Dave Hansen
On 07/17/2018 08:25 PM, Huang, Ying wrote: >> Seriously, though, does it hurt us to add a comment or two to say >> something like: >> >> /* >> * Should not even be attempting cluster allocations when >> * huge page swap is disabled. Warn and fail the allocation. >> */ >>

Re: [PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-18 Thread Dave Hansen
On 07/17/2018 08:25 PM, Huang, Ying wrote: >> Seriously, though, does it hurt us to add a comment or two to say >> something like: >> >> /* >> * Should not even be attempting cluster allocations when >> * huge page swap is disabled. Warn and fail the allocation. >> */ >>

Re: [PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-17 Thread Huang, Ying
Dave Hansen writes: >> @@ -878,6 +877,11 @@ static int swap_alloc_cluster(struct swap_info_struct >> *si, swp_entry_t *slot) >> unsigned long offset, i; >> unsigned char *map; >> >> +if (!IS_ENABLED(CONFIG_THP_SWAP)) { >> +VM_WARN_ON_ONCE(1); >> +return

Re: [PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-17 Thread Huang, Ying
Dave Hansen writes: >> @@ -878,6 +877,11 @@ static int swap_alloc_cluster(struct swap_info_struct >> *si, swp_entry_t *slot) >> unsigned long offset, i; >> unsigned char *map; >> >> +if (!IS_ENABLED(CONFIG_THP_SWAP)) { >> +VM_WARN_ON_ONCE(1); >> +return

Re: [PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-17 Thread Dave Hansen
> @@ -878,6 +877,11 @@ static int swap_alloc_cluster(struct swap_info_struct > *si, swp_entry_t *slot) > unsigned long offset, i; > unsigned char *map; > > + if (!IS_ENABLED(CONFIG_THP_SWAP)) { > + VM_WARN_ON_ONCE(1); > + return 0; > + } I see you

Re: [PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-17 Thread Dave Hansen
> @@ -878,6 +877,11 @@ static int swap_alloc_cluster(struct swap_info_struct > *si, swp_entry_t *slot) > unsigned long offset, i; > unsigned char *map; > > + if (!IS_ENABLED(CONFIG_THP_SWAP)) { > + VM_WARN_ON_ONCE(1); > + return 0; > + } I see you

[PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-16 Thread Huang, Ying
In mm/swapfile.c, THP (Transparent Huge Page) swap specific code is enclosed by #ifdef CONFIG_THP_SWAP/#endif to avoid code dilating when THP isn't enabled. But #ifdef/#endif in .c file hurt the code readability, so Dave suggested to use IS_ENABLED(CONFIG_THP_SWAP) instead and let compiler to do

[PATCH v2 2/7] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()

2018-07-16 Thread Huang, Ying
In mm/swapfile.c, THP (Transparent Huge Page) swap specific code is enclosed by #ifdef CONFIG_THP_SWAP/#endif to avoid code dilating when THP isn't enabled. But #ifdef/#endif in .c file hurt the code readability, so Dave suggested to use IS_ENABLED(CONFIG_THP_SWAP) instead and let compiler to do