mm/page_reporting: the "page" must not be the list head
Subsystems (2)
PATCH 1/1 mm/page_reporting: the "page" must not be the list head
If "page" is the list head, list_for_each_entry_safe() would stop iteration.
--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_reporting.c +1 -1
@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);/* release lock before waiting on report processing */
Signature · 1 line
2.20.1 (Apple Git-117)
Quoted 14 lines · Wei Yang
If "page" is the list head,
list_for_each_entry_safe()would stop iteration.Signed-off-by Wei Yang <[email protected]>--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/page_reporting.c +0
-0
mm/page_reporting.c page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · line 184
Quoted 8 lines
mm/page_reporting.c +1
-1@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);/* release lock before waiting on report processing */
Is this a fix or a cleanup? If it's a fix, can this be reproduced easily and what ere the effects?
Signature · 3 lines
Thanks, David / dhildenb
Quoted 21 lines · David Hildenbrand
Quoted 20 lines · Wei Yang
If "page" is the list head,
list_for_each_entry_safe()would stop iteration.Signed-off-by Wei Yang <[email protected]>--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/page_reporting.c +1
-1@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);
Quoted 6 lines
mm/page_reporting.c page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · line 184
Quoted 2 lines
mm/page_reporting.c +0
-0/* release lock before waiting on report processing */ Is this a fix or a cleanup? If it's a fix, can this be reproduced easily and what ere the effects?
This should be a clean-up. Since the &page->lru != list will always be true.
If I recall at some point the that was a check for &next->lru != list but I think I pulled out an additional conditional check somewhere so that we just go through the start of the loop again and iterate over reported pages until we are guaranteed to have a non-reported page to rotate to the top of the list with the general idea being that we wanted the allocator to pull non-reported pages before reported pages.
Quoted 24 lines · Alexander Duyck
Quoted 21 lines · David Hildenbrand
Quoted 20 lines · Wei Yang
If "page" is the list head,
list_for_each_entry_safe()would stop iteration.Signed-off-by Wei Yang <[email protected]>--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/page_reporting.c +1
-1@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);
Quoted 9 lines
Quoted 6 lines
mm/page_reporting.c page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · line 184
Quoted 2 lines
mm/page_reporting.c +0
-0/* release lock before waiting on report processing */ Is this a fix or a cleanup? If it's a fix, can this be reproduced easily and what ere the effects?
This should be a clean-up. Since the
&page->lru!= list will always be true.
Makes sense, maybe we can make that a little bit clearer in the patch description.
Quoted 6 lines
If I recall at some point the that was a check for
&next->lru!= list but I think I pulled out an additional conditional check somewhere so that we just go through the start of the loop again and iterate over reported pages until we are guaranteed to have a non-reported page to rotate to the top of the list with the general idea being that we wanted the allocator to pull non-reported pages before reported pages.
Signature · 3 lines
Thanks, David / dhildenb
Quoted 32 lines · David Hildenbrand
Quoted 31 lines · Alexander Duyck
Quoted 27 lines · David Hildenbrand
Quoted 14 lines · Wei Yang
If "page" is the list head,
list_for_each_entry_safe()would stop iteration.Signed-off-by Wei Yang <[email protected]>--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/page_reporting.c +0
-0mm/page_reporting.c page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · line 184
Quoted 8 lines
mm/page_reporting.c +1
-1@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);/* release lock before waiting on report processing */ Is this a fix or a cleanup? If it's a fix, can this be reproduced easily and what ere the effects?
Quoted 6 lines
Quoted 2 lines
This should be a clean-up. Since the
&page->lru!= list will always be true.Makes sense, maybe we can make that a little bit clearer in the patch description.
Ok, do you have some suggestion on the description?
A clean-up for commit xxx?
I would appreciate your suggestion :-)
Quoted 11 lines
Quoted 6 lines
If I recall at some point the that was a check for
&next->lru!= list but I think I pulled out an additional conditional check somewhere so that we just go through the start of the loop again and iterate over reported pages until we are guaranteed to have a non-reported page to rotate to the top of the list with the general idea being that we wanted the allocator to pull non-reported pages before reported pages.Signature · 3 lines
Thanks, David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me
David Hildenbrand
Reviewed-byQuoted 40 lines · Wei Yang
Quoted 32 lines · David Hildenbrand
Quoted 31 lines · Alexander Duyck
Quoted 27 lines · David Hildenbrand
Quoted 14 lines · Wei Yang
If "page" is the list head,
list_for_each_entry_safe()would stop iteration.Signed-off-by Wei Yang <[email protected]>--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/page_reporting.c +0
-0mm/page_reporting.c page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · line 184
Quoted 8 lines
mm/page_reporting.c +1
-1@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);/* release lock before waiting on report processing */ Is this a fix or a cleanup? If it's a fix, can this be reproduced easily and what ere the effects?
Quoted 6 lines
Quoted 2 lines
This should be a clean-up. Since the
&page->lru!= list will always be true.Makes sense, maybe we can make that a little bit clearer in the patch description.
Quoted 6 lines
Ok, do you have some suggestion on the description?
A clean-up for commit xxx?
I would appreciate your suggestion :-)
I'd go with something like
"mm/page_reporting: drop stale list head check in page_reporting_cycle
list_for_each_entry_safe() guarantees that we will never stumble over the list head; "&page->lru != list" will always evaluate to true. Let's simplify.
"
to stress that this is a pure simplifcation.
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
If I recall at some point the that was a check for
&next->lru!= list but I think I pulled out an additional conditional check somewhere so that we just go through the start of the loop again and iterate over reported pages until we are guaranteed to have a non-reported page to rotate to the top of the list with the general idea being that we wanted the allocator to pull non-reported pages before reported pages.Signature · 3 lines
Thanks, David / dhildenb
Signature · 3 lines
Thanks, David / dhildenb
Quoted 50 lines · David Hildenbrand
Quoted 40 lines · Wei Yang
Quoted 32 lines · David Hildenbrand
Quoted 31 lines · Alexander Duyck
Quoted 27 lines · David Hildenbrand
Quoted 14 lines · Wei Yang
If "page" is the list head,
list_for_each_entry_safe()would stop iteration.Signed-off-by Wei Yang <[email protected]>--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/page_reporting.c +0
-0mm/page_reporting.c page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · line 184
Quoted 8 lines
mm/page_reporting.c +1
-1@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);/* release lock before waiting on report processing */ Is this a fix or a cleanup? If it's a fix, can this be reproduced easily and what ere the effects?
Quoted 6 lines
Quoted 2 lines
This should be a clean-up. Since the
&page->lru!= list will always be true.Makes sense, maybe we can make that a little bit clearer in the patch description.
Quoted 6 lines
Ok, do you have some suggestion on the description?
A clean-up for commit xxx?
I would appreciate your suggestion :-)
I'd go with something like
Quoted 8 lines
"
mm/page_reporting: drop stale list head check inpage_reporting_cycle
list_for_each_entry_safe()guarantees that we will never stumble over the list head; "&page->lru!= list" will always evaluate to true. Let's simplify.
"
Looks really better than mine. Thanks a lot.
Quoted 22 lines
to stress that this is a pure simplifcation.
Reviewed-by David Hildenbrand <[email protected]>Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
If I recall at some point the that was a check for
&next->lru!= list but I think I pulled out an additional conditional check somewhere so that we just go through the start of the loop again and iterate over reported pages until we are guaranteed to have a non-reported page to rotate to the top of the list with the general idea being that we wanted the allocator to pull non-reported pages before reported pages.Signature · 3 lines
Thanks, David / dhildenbSignature · 3 lines
Thanks, David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 30 lines · Alexander Duyck
Quoted 9 lines · David Hildenbrand
Quoted 8 lines · Wei Yang
If "page" is the list head,
list_for_each_entry_safe()would stop iteration.Signed-off-by Wei Yang <[email protected]>--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 17 lines
mm/page_reporting.c page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · line 184
Quoted 13 lines
mm/page_reporting.c +1
-1@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);/* release lock before waiting on report processing */ Is this a fix or a cleanup? If it's a fix, can this be reproduced easily and what ere the effects?
Quoted 8 lines
This should be a clean-up. Since the
&page->lru!= list will always be true.If I recall at some point the that was a check for
&next->lru!= list but I think I pulled out an additional conditional check somewhere so that we just go through the start of the loop again and iterate over reported pages until we are guaranteed to have a non-reported page to rotate to the top of the list with the general idea being that we wanted the allocator to pull non-reported pages before reported pages.
Hi, Alexander,
I see you mentioned in the changelog, this change "mm/page_reporting: rotate reported pages to the tail of the list" brings some performance gain.
Would you mind sharing more test detail? I would like to have a try at my side.
Thanks :-)
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 43 lines · Wei Yang
Quoted 30 lines · Alexander Duyck
Quoted 9 lines · David Hildenbrand
Quoted 8 lines · Wei Yang
If "page" is the list head,
list_for_each_entry_safe()would stop iteration.Signed-off-by Wei Yang <[email protected]>--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 17 lines
mm/page_reporting.c page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · line 184
Quoted 13 lines
mm/page_reporting.c +1
-1@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);/* release lock before waiting on report processing */ Is this a fix or a cleanup? If it's a fix, can this be reproduced easily and what ere the effects?
Quoted 8 lines
This should be a clean-up. Since the
&page->lru!= list will always be true.If I recall at some point the that was a check for
&next->lru!= list but I think I pulled out an additional conditional check somewhere so that we just go through the start of the loop again and iterate over reported pages until we are guaranteed to have a non-reported page to rotate to the top of the list with the general idea being that we wanted the allocator to pull non-reported pages before reported pages.Hi, Alexander,
Quoted 7 lines
I see you mentioned in the changelog, this change "
mm/page_reporting: rotate reported pages to the tail of the list" brings some performance gain.Would you mind sharing more test detail? I would like to have a try at my side.
Thanks :-)
I seem to recall my default test for most of this was the page_fault1 test from the will-it-scale suite of tests. Basically I was running that while leaving page reporting enabled. However I don't know how much visibility you would have into the performance impact as I seem to recall I had to modify the frequency of scheduling for the reporting polling task in order to see much of an impact.
Thanks.
- Alex
Quoted 21 lines · David Hildenbrand
Quoted 20 lines · Wei Yang
If "page" is the list head,
list_for_each_entry_safe()would stop iteration.Signed-off-by Wei Yang <[email protected]>--- mm/page_reporting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/page_reporting.c +1
-1@@ -178,7 +178,7 @@ page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone,* the new head of the free list before we release the * zone lock. */ -if (&page->lru != list && !list_is_first (&page->lru, list)) +if (!list_is_first (&page->lru, list))list_rotate_to_front (&page->lru, list);
Quoted 6 lines
mm/page_reporting.c page_reporting_cycle(struct page_reporting_dev_info *prdev, struct zone *zone, · line 184
Quoted 2 lines
mm/page_reporting.c +0
-0/* release lock before waiting on report processing */ Is this a fix or a cleanup? If it's a fix, can this be reproduced easily and what ere the effects?
I think this is a cleanup.
I am not sure why you ask this, since the check must be true when the iteration continues.
Quoted 4 lines
Signature · 3 lines
Thanks, David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me