All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
@ 2017-10-19 14:56 ` Anshuman Khandual
  0 siblings, 0 replies; 14+ messages in thread
From: Anshuman Khandual @ 2017-10-19 14:56 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: akpm, shli

Its already assumed that the PageActive flag is clear on the input
page, hence page_lru(page) will pick the base LRU for the page. In
the same way page_lru(page) will pick active base LRU, once the
flag PageActive is set on the page. This change of LRU list should
happen implicitly through the page flags instead of being hard
coded.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
 mm/swap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/swap.c b/mm/swap.c
index fcd82bc..494276b 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -275,12 +275,10 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
 {
 	if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
 		int file = page_is_file_cache(page);
-		int lru = page_lru_base_type(page);
 
-		del_page_from_lru_list(page, lruvec, lru);
+		del_page_from_lru_list(page, lruvec, page_lru(page));
 		SetPageActive(page);
-		lru += LRU_ACTIVE;
-		add_page_to_lru_list(page, lruvec, lru);
+		add_page_to_lru_list(page, lruvec, page_lru(page));
 		trace_mm_lru_activate(page);
 
 		__count_vm_event(PGACTIVATE);
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
@ 2017-10-19 14:56 ` Anshuman Khandual
  0 siblings, 0 replies; 14+ messages in thread
From: Anshuman Khandual @ 2017-10-19 14:56 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: akpm, shli

Its already assumed that the PageActive flag is clear on the input
page, hence page_lru(page) will pick the base LRU for the page. In
the same way page_lru(page) will pick active base LRU, once the
flag PageActive is set on the page. This change of LRU list should
happen implicitly through the page flags instead of being hard
coded.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
 mm/swap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/swap.c b/mm/swap.c
index fcd82bc..494276b 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -275,12 +275,10 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
 {
 	if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
 		int file = page_is_file_cache(page);
-		int lru = page_lru_base_type(page);
 
-		del_page_from_lru_list(page, lruvec, lru);
+		del_page_from_lru_list(page, lruvec, page_lru(page));
 		SetPageActive(page);
-		lru += LRU_ACTIVE;
-		add_page_to_lru_list(page, lruvec, lru);
+		add_page_to_lru_list(page, lruvec, page_lru(page));
 		trace_mm_lru_activate(page);
 
 		__count_vm_event(PGACTIVATE);
-- 
1.8.5.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
  2017-10-19 14:56 ` Anshuman Khandual
@ 2017-10-19 15:33   ` Michal Hocko
  -1 siblings, 0 replies; 14+ messages in thread
From: Michal Hocko @ 2017-10-19 15:33 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-mm, linux-kernel, akpm, shli

On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
> Its already assumed that the PageActive flag is clear on the input
> page, hence page_lru(page) will pick the base LRU for the page. In
> the same way page_lru(page) will pick active base LRU, once the
> flag PageActive is set on the page. This change of LRU list should
> happen implicitly through the page flags instead of being hard
> coded.

The patch description tells what but it doesn't explain _why_? Does the
resulting code is better, more optimized or is this a pure readability
thing?

All I can see is that page_lru is more complex and a large part of it
can be optimized away which has been done manually here. I suspect the
compiler can deduce the same thing.

> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
> ---
>  mm/swap.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/swap.c b/mm/swap.c
> index fcd82bc..494276b 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -275,12 +275,10 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
>  {
>  	if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
>  		int file = page_is_file_cache(page);
> -		int lru = page_lru_base_type(page);
>  
> -		del_page_from_lru_list(page, lruvec, lru);
> +		del_page_from_lru_list(page, lruvec, page_lru(page));
>  		SetPageActive(page);
> -		lru += LRU_ACTIVE;
> -		add_page_to_lru_list(page, lruvec, lru);
> +		add_page_to_lru_list(page, lruvec, page_lru(page));
>  		trace_mm_lru_activate(page);
>  
>  		__count_vm_event(PGACTIVATE);
> -- 
> 1.8.5.2

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
@ 2017-10-19 15:33   ` Michal Hocko
  0 siblings, 0 replies; 14+ messages in thread
From: Michal Hocko @ 2017-10-19 15:33 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-mm, linux-kernel, akpm, shli

On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
> Its already assumed that the PageActive flag is clear on the input
> page, hence page_lru(page) will pick the base LRU for the page. In
> the same way page_lru(page) will pick active base LRU, once the
> flag PageActive is set on the page. This change of LRU list should
> happen implicitly through the page flags instead of being hard
> coded.

The patch description tells what but it doesn't explain _why_? Does the
resulting code is better, more optimized or is this a pure readability
thing?

All I can see is that page_lru is more complex and a large part of it
can be optimized away which has been done manually here. I suspect the
compiler can deduce the same thing.

> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
> ---
>  mm/swap.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/swap.c b/mm/swap.c
> index fcd82bc..494276b 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -275,12 +275,10 @@ static void __activate_page(struct page *page, struct lruvec *lruvec,
>  {
>  	if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
>  		int file = page_is_file_cache(page);
> -		int lru = page_lru_base_type(page);
>  
> -		del_page_from_lru_list(page, lruvec, lru);
> +		del_page_from_lru_list(page, lruvec, page_lru(page));
>  		SetPageActive(page);
> -		lru += LRU_ACTIVE;
> -		add_page_to_lru_list(page, lruvec, lru);
> +		add_page_to_lru_list(page, lruvec, page_lru(page));
>  		trace_mm_lru_activate(page);
>  
>  		__count_vm_event(PGACTIVATE);
> -- 
> 1.8.5.2

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
  2017-10-19 15:33   ` Michal Hocko
@ 2017-10-23  3:22     ` Anshuman Khandual
  -1 siblings, 0 replies; 14+ messages in thread
From: Anshuman Khandual @ 2017-10-23  3:22 UTC (permalink / raw)
  To: Michal Hocko, Anshuman Khandual; +Cc: linux-mm, linux-kernel, akpm, shli

On 10/19/2017 09:03 PM, Michal Hocko wrote:
> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
>> Its already assumed that the PageActive flag is clear on the input
>> page, hence page_lru(page) will pick the base LRU for the page. In
>> the same way page_lru(page) will pick active base LRU, once the
>> flag PageActive is set on the page. This change of LRU list should
>> happen implicitly through the page flags instead of being hard
>> coded.
> 
> The patch description tells what but it doesn't explain _why_? Does the
> resulting code is better, more optimized or is this a pure readability
> thing?

Not really. Not only it removes couple of lines of code but it also
makes it look more logical from function flow point of view as well.

> 
> All I can see is that page_lru is more complex and a large part of it
> can be optimized away which has been done manually here. I suspect the
> compiler can deduce the same thing.

Why not ? I mean, that is the essence of the function page_lru() which
should get us the exact LRU list the page should be on and hence we
should not hand craft these manually.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
@ 2017-10-23  3:22     ` Anshuman Khandual
  0 siblings, 0 replies; 14+ messages in thread
From: Anshuman Khandual @ 2017-10-23  3:22 UTC (permalink / raw)
  To: Michal Hocko, Anshuman Khandual; +Cc: linux-mm, linux-kernel, akpm, shli

On 10/19/2017 09:03 PM, Michal Hocko wrote:
> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
>> Its already assumed that the PageActive flag is clear on the input
>> page, hence page_lru(page) will pick the base LRU for the page. In
>> the same way page_lru(page) will pick active base LRU, once the
>> flag PageActive is set on the page. This change of LRU list should
>> happen implicitly through the page flags instead of being hard
>> coded.
> 
> The patch description tells what but it doesn't explain _why_? Does the
> resulting code is better, more optimized or is this a pure readability
> thing?

Not really. Not only it removes couple of lines of code but it also
makes it look more logical from function flow point of view as well.

> 
> All I can see is that page_lru is more complex and a large part of it
> can be optimized away which has been done manually here. I suspect the
> compiler can deduce the same thing.

Why not ? I mean, that is the essence of the function page_lru() which
should get us the exact LRU list the page should be on and hence we
should not hand craft these manually.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
  2017-10-23  3:22     ` Anshuman Khandual
@ 2017-10-27  4:06       ` Anshuman Khandual
  -1 siblings, 0 replies; 14+ messages in thread
From: Anshuman Khandual @ 2017-10-27  4:06 UTC (permalink / raw)
  To: Anshuman Khandual, Michal Hocko; +Cc: linux-mm, linux-kernel, akpm, shli

On 10/23/2017 08:52 AM, Anshuman Khandual wrote:
> On 10/19/2017 09:03 PM, Michal Hocko wrote:
>> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
>>> Its already assumed that the PageActive flag is clear on the input
>>> page, hence page_lru(page) will pick the base LRU for the page. In
>>> the same way page_lru(page) will pick active base LRU, once the
>>> flag PageActive is set on the page. This change of LRU list should
>>> happen implicitly through the page flags instead of being hard
>>> coded.
>>
>> The patch description tells what but it doesn't explain _why_? Does the
>> resulting code is better, more optimized or is this a pure readability
>> thing?
> 
> Not really. Not only it removes couple of lines of code but it also
> makes it look more logical from function flow point of view as well.
> 
>>
>> All I can see is that page_lru is more complex and a large part of it
>> can be optimized away which has been done manually here. I suspect the
>> compiler can deduce the same thing.
> 
> Why not ? I mean, that is the essence of the function page_lru() which
> should get us the exact LRU list the page should be on and hence we
> should not hand craft these manually.

Hi Michal,

Did not hear from you on this. So wondering what is the verdict
about this patch ?

- Anshuman

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
@ 2017-10-27  4:06       ` Anshuman Khandual
  0 siblings, 0 replies; 14+ messages in thread
From: Anshuman Khandual @ 2017-10-27  4:06 UTC (permalink / raw)
  To: Anshuman Khandual, Michal Hocko; +Cc: linux-mm, linux-kernel, akpm, shli

On 10/23/2017 08:52 AM, Anshuman Khandual wrote:
> On 10/19/2017 09:03 PM, Michal Hocko wrote:
>> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
>>> Its already assumed that the PageActive flag is clear on the input
>>> page, hence page_lru(page) will pick the base LRU for the page. In
>>> the same way page_lru(page) will pick active base LRU, once the
>>> flag PageActive is set on the page. This change of LRU list should
>>> happen implicitly through the page flags instead of being hard
>>> coded.
>>
>> The patch description tells what but it doesn't explain _why_? Does the
>> resulting code is better, more optimized or is this a pure readability
>> thing?
> 
> Not really. Not only it removes couple of lines of code but it also
> makes it look more logical from function flow point of view as well.
> 
>>
>> All I can see is that page_lru is more complex and a large part of it
>> can be optimized away which has been done manually here. I suspect the
>> compiler can deduce the same thing.
> 
> Why not ? I mean, that is the essence of the function page_lru() which
> should get us the exact LRU list the page should be on and hence we
> should not hand craft these manually.

Hi Michal,

Did not hear from you on this. So wondering what is the verdict
about this patch ?

- Anshuman

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
  2017-10-27  4:06       ` Anshuman Khandual
@ 2017-10-27  7:57         ` Michal Hocko
  -1 siblings, 0 replies; 14+ messages in thread
From: Michal Hocko @ 2017-10-27  7:57 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-mm, linux-kernel, akpm, shli

On Fri 27-10-17 09:36:37, Anshuman Khandual wrote:
> On 10/23/2017 08:52 AM, Anshuman Khandual wrote:
> > On 10/19/2017 09:03 PM, Michal Hocko wrote:
> >> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
> >>> Its already assumed that the PageActive flag is clear on the input
> >>> page, hence page_lru(page) will pick the base LRU for the page. In
> >>> the same way page_lru(page) will pick active base LRU, once the
> >>> flag PageActive is set on the page. This change of LRU list should
> >>> happen implicitly through the page flags instead of being hard
> >>> coded.
> >>
> >> The patch description tells what but it doesn't explain _why_? Does the
> >> resulting code is better, more optimized or is this a pure readability
> >> thing?
> > 
> > Not really. Not only it removes couple of lines of code but it also
> > makes it look more logical from function flow point of view as well.
> > 
> >>
> >> All I can see is that page_lru is more complex and a large part of it
> >> can be optimized away which has been done manually here. I suspect the
> >> compiler can deduce the same thing.
> > 
> > Why not ? I mean, that is the essence of the function page_lru() which
> > should get us the exact LRU list the page should be on and hence we
> > should not hand craft these manually.
> 
> Hi Michal,
> 
> Did not hear from you on this. So wondering what is the verdict
> about this patch ?

IMHO, there is no reason to change the code as it doesn't solve any real
problem or it doesn't make the code more effective AFAICS.
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
@ 2017-10-27  7:57         ` Michal Hocko
  0 siblings, 0 replies; 14+ messages in thread
From: Michal Hocko @ 2017-10-27  7:57 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-mm, linux-kernel, akpm, shli

On Fri 27-10-17 09:36:37, Anshuman Khandual wrote:
> On 10/23/2017 08:52 AM, Anshuman Khandual wrote:
> > On 10/19/2017 09:03 PM, Michal Hocko wrote:
> >> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
> >>> Its already assumed that the PageActive flag is clear on the input
> >>> page, hence page_lru(page) will pick the base LRU for the page. In
> >>> the same way page_lru(page) will pick active base LRU, once the
> >>> flag PageActive is set on the page. This change of LRU list should
> >>> happen implicitly through the page flags instead of being hard
> >>> coded.
> >>
> >> The patch description tells what but it doesn't explain _why_? Does the
> >> resulting code is better, more optimized or is this a pure readability
> >> thing?
> > 
> > Not really. Not only it removes couple of lines of code but it also
> > makes it look more logical from function flow point of view as well.
> > 
> >>
> >> All I can see is that page_lru is more complex and a large part of it
> >> can be optimized away which has been done manually here. I suspect the
> >> compiler can deduce the same thing.
> > 
> > Why not ? I mean, that is the essence of the function page_lru() which
> > should get us the exact LRU list the page should be on and hence we
> > should not hand craft these manually.
> 
> Hi Michal,
> 
> Did not hear from you on this. So wondering what is the verdict
> about this patch ?

IMHO, there is no reason to change the code as it doesn't solve any real
problem or it doesn't make the code more effective AFAICS.
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
  2017-10-19 15:33   ` Michal Hocko
@ 2017-10-31 12:45     ` Vlastimil Babka
  -1 siblings, 0 replies; 14+ messages in thread
From: Vlastimil Babka @ 2017-10-31 12:45 UTC (permalink / raw)
  To: Michal Hocko, Anshuman Khandual; +Cc: linux-mm, linux-kernel, akpm, shli

On 10/19/2017 05:33 PM, Michal Hocko wrote:
> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
>> Its already assumed that the PageActive flag is clear on the input
>> page, hence page_lru(page) will pick the base LRU for the page. In
>> the same way page_lru(page) will pick active base LRU, once the
>> flag PageActive is set on the page. This change of LRU list should
>> happen implicitly through the page flags instead of being hard
>> coded.
> 
> The patch description tells what but it doesn't explain _why_? Does the
> resulting code is better, more optimized or is this a pure readability
> thing?
> 
> All I can see is that page_lru is more complex and a large part of it
> can be optimized away which has been done manually here. I suspect the
> compiler can deduce the same thing.

We shouldn't overestimate the compiler (or the objective conditions it
has) for optimizing stuff away:

After applying the patch:

./scripts/bloat-o-meter swap_before.o mm/swap.o
add/remove: 0/0 grow/shrink: 1/0 up/down: 160/0 (160)
function                                     old     new   delta
__activate_page                              708     868    +160
Total: Before=13538, After=13698, chg +1.18%

I don't think we want that, it's not exactly a cold code...

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
@ 2017-10-31 12:45     ` Vlastimil Babka
  0 siblings, 0 replies; 14+ messages in thread
From: Vlastimil Babka @ 2017-10-31 12:45 UTC (permalink / raw)
  To: Michal Hocko, Anshuman Khandual; +Cc: linux-mm, linux-kernel, akpm, shli

On 10/19/2017 05:33 PM, Michal Hocko wrote:
> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
>> Its already assumed that the PageActive flag is clear on the input
>> page, hence page_lru(page) will pick the base LRU for the page. In
>> the same way page_lru(page) will pick active base LRU, once the
>> flag PageActive is set on the page. This change of LRU list should
>> happen implicitly through the page flags instead of being hard
>> coded.
> 
> The patch description tells what but it doesn't explain _why_? Does the
> resulting code is better, more optimized or is this a pure readability
> thing?
> 
> All I can see is that page_lru is more complex and a large part of it
> can be optimized away which has been done manually here. I suspect the
> compiler can deduce the same thing.

We shouldn't overestimate the compiler (or the objective conditions it
has) for optimizing stuff away:

After applying the patch:

./scripts/bloat-o-meter swap_before.o mm/swap.o
add/remove: 0/0 grow/shrink: 1/0 up/down: 160/0 (160)
function                                     old     new   delta
__activate_page                              708     868    +160
Total: Before=13538, After=13698, chg +1.18%

I don't think we want that, it's not exactly a cold code...

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
  2017-10-31 12:45     ` Vlastimil Babka
@ 2017-11-02 11:44       ` Anshuman Khandual
  -1 siblings, 0 replies; 14+ messages in thread
From: Anshuman Khandual @ 2017-11-02 11:44 UTC (permalink / raw)
  To: Vlastimil Babka, Michal Hocko, Anshuman Khandual
  Cc: linux-mm, linux-kernel, akpm, shli

On 10/31/2017 06:15 PM, Vlastimil Babka wrote:
> On 10/19/2017 05:33 PM, Michal Hocko wrote:
>> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
>>> Its already assumed that the PageActive flag is clear on the input
>>> page, hence page_lru(page) will pick the base LRU for the page. In
>>> the same way page_lru(page) will pick active base LRU, once the
>>> flag PageActive is set on the page. This change of LRU list should
>>> happen implicitly through the page flags instead of being hard
>>> coded.
>>
>> The patch description tells what but it doesn't explain _why_? Does the
>> resulting code is better, more optimized or is this a pure readability
>> thing?
>>
>> All I can see is that page_lru is more complex and a large part of it
>> can be optimized away which has been done manually here. I suspect the
>> compiler can deduce the same thing.
> 
> We shouldn't overestimate the compiler (or the objective conditions it
> has) for optimizing stuff away:
> 
> After applying the patch:
> 
> ./scripts/bloat-o-meter swap_before.o mm/swap.o
> add/remove: 0/0 grow/shrink: 1/0 up/down: 160/0 (160)
> function                                     old     new   delta
> __activate_page                              708     868    +160
> Total: Before=13538, After=13698, chg +1.18%
> 
> I don't think we want that, it's not exactly a cold code...

Yeah, makes sense.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page()
@ 2017-11-02 11:44       ` Anshuman Khandual
  0 siblings, 0 replies; 14+ messages in thread
From: Anshuman Khandual @ 2017-11-02 11:44 UTC (permalink / raw)
  To: Vlastimil Babka, Michal Hocko, Anshuman Khandual
  Cc: linux-mm, linux-kernel, akpm, shli

On 10/31/2017 06:15 PM, Vlastimil Babka wrote:
> On 10/19/2017 05:33 PM, Michal Hocko wrote:
>> On Thu 19-10-17 20:26:57, Anshuman Khandual wrote:
>>> Its already assumed that the PageActive flag is clear on the input
>>> page, hence page_lru(page) will pick the base LRU for the page. In
>>> the same way page_lru(page) will pick active base LRU, once the
>>> flag PageActive is set on the page. This change of LRU list should
>>> happen implicitly through the page flags instead of being hard
>>> coded.
>>
>> The patch description tells what but it doesn't explain _why_? Does the
>> resulting code is better, more optimized or is this a pure readability
>> thing?
>>
>> All I can see is that page_lru is more complex and a large part of it
>> can be optimized away which has been done manually here. I suspect the
>> compiler can deduce the same thing.
> 
> We shouldn't overestimate the compiler (or the objective conditions it
> has) for optimizing stuff away:
> 
> After applying the patch:
> 
> ./scripts/bloat-o-meter swap_before.o mm/swap.o
> add/remove: 0/0 grow/shrink: 1/0 up/down: 160/0 (160)
> function                                     old     new   delta
> __activate_page                              708     868    +160
> Total: Before=13538, After=13698, chg +1.18%
> 
> I don't think we want that, it's not exactly a cold code...

Yeah, makes sense.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-11-02 11:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 14:56 [PATCH] mm/swap: Use page flags to determine LRU list in __activate_page() Anshuman Khandual
2017-10-19 14:56 ` Anshuman Khandual
2017-10-19 15:33 ` Michal Hocko
2017-10-19 15:33   ` Michal Hocko
2017-10-23  3:22   ` Anshuman Khandual
2017-10-23  3:22     ` Anshuman Khandual
2017-10-27  4:06     ` Anshuman Khandual
2017-10-27  4:06       ` Anshuman Khandual
2017-10-27  7:57       ` Michal Hocko
2017-10-27  7:57         ` Michal Hocko
2017-10-31 12:45   ` Vlastimil Babka
2017-10-31 12:45     ` Vlastimil Babka
2017-11-02 11:44     ` Anshuman Khandual
2017-11-02 11:44       ` Anshuman Khandual

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.