Skip to contentSkip to conversation

mm/swap: make release_pages() and put_pages() match

RFC PATCH In review [email protected] 2 participants 3 messages May 24, 2019 Memory management

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 mm/swap: make release_pages() and put_pages() match

From: Ira Weiny <[email protected]>

RFC I have no idea if this is correct or not. But looking at release_pages() I see a call to both __ClearPageActive() and __ClearPageWaiters() while in __page_cache_release() I do not.

Is this a bug which needs to be fixed? Did I miss clearing active somewhere else in the call chain of put_page?

This was found via code inspection while determining if release_pages() and the new put_user_pages() could be interchangeable.

---
 mm/swap.c | 1 +
 1 file changed, 1 insertion(+)
mm/swap.c +1 -0
index 3a75722e68a9..9d0432baddb0 100644
@@ -69,6 +69,7 @@ static void __page_cache_release(struct page *page)
 		del_page_from_lru_list(page, lruvec, page_off_lru(page));
 		spin_unlock_irqrestore(&pgdat->lru_lock, flags);
 	}
+	__ClearPageActive(page);
 	__ClearPageWaiters(page);
 	mem_cgroup_uncharge(page);
 }
Signature · 1 line
2.20.1
#1 lore raw
Quoted 23 lines · On Fri, May 24, 2019 at 12:33 PM <[email protected]> wrote:

From: Ira Weiny <[email protected]>

RFC I have no idea if this is correct or not. But looking at release_pages() I see a call to both __ClearPageActive() and __ClearPageWaiters() while in __page_cache_release() I do not.

Is this a bug which needs to be fixed? Did I miss clearing active somewhere else in the call chain of put_page?

This was found via code inspection while determining if release_pages() and the new put_user_pages() could be interchangeable.

---
 mm/swap.c | 1 +
 1 file changed, 1 insertion(+)
mm/swap.c +0 -0
index 3a75722e68a9..9d0432baddb0 100644

mm/swap.c static void __page_cache_release(struct page *page) · line 69

Quoted 1 line
mm/swap.c +0 -0
@@ -69,6 +69,7 @@ static void __page_cache_release(struct page *page)
                del_page_from_lru_list(page, lruvec, page_off_lru(page));

see page_off_lru(page) above which clear active bit.

Quoted 9 lines
mm/swap.c +1 -1
                spin_unlock_irqrestore(&pgdat->lru_lock, flags);
        }
+       __ClearPageActive(page);
        __ClearPageWaiters(page);
        mem_cgroup_uncharge(page);
 }
--

2.20.1

author
#2 lore raw
Quoted 20 lines · On Fri, May 24, 2019 at 12:33 PM <[email protected]> wrote:
Quoted 18 lines

From: Ira Weiny <[email protected]>

RFC I have no idea if this is correct or not. But looking at release_pages() I see a call to both __ClearPageActive() and __ClearPageWaiters() while in __page_cache_release() I do not.

Is this a bug which needs to be fixed? Did I miss clearing active somewhere else in the call chain of put_page?

This was found via code inspection while determining if release_pages() and the new put_user_pages() could be interchangeable.

---
 mm/swap.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 9 lines

mm/swap.c static void __page_cache_release(struct page *page) · line 70

Quoted 7 lines
mm/swap.c +0 -0
index 3a75722e68a9..9d0432baddb0 100644
@@ -69,6 +69,7 @@ static void __page_cache_release(struct page *page)
                del_page_from_lru_list(page, lruvec,
 page_off_lru(page));

see page_off_lru(page) above which clear active bit.

Thanks, Sorry for the noise,
Ira

Quoted 10 lines
Quoted 10 lines
mm/swap.c +1 -0
                spin_unlock_irqrestore(&pgdat->lru_lock, flags);
        }
+       __ClearPageActive(page);
        __ClearPageWaiters(page);
        mem_cgroup_uncharge(page);

}
--
2.20.1