Skip to contentSkip to conversation

mm/page_reporting: drop stale list head check in page_reporting_cycle

PATCH Applied Wei Yang 2 participants 3 messages Aug 18, 2020

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH v2 1/1 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.

---
 mm/page_reporting.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_reporting.c +1 -1
index 3bbd471cfc81..aaaa3605123d 100644
@@ -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)
author
#1 lore raw
Quoted 3 lines · Wei Yang

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.

[[email protected]: Changelog refine.]

Quoted 22 lines

---
mm/page_reporting.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_reporting.c +1 -1
index 3bbd471cfc81..aaaa3605123d 100644
@@ -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)
Signature · 2 lines
Wei Yang
Help you, Help me
Reviewed-by on v2 1/1
#2 lore raw
In reply to Wei Yang
Quoted 16 lines · Wei Yang

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.

---
 mm/page_reporting.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_reporting.c +0 -0
index 3bbd471cfc81..aaaa3605123d 100644

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 */