[7/7] mm,hwpoison: Remove drain_all_pages from shake_page
diff mbox series

Message ID 20201119105716.5962-8-osalvador@suse.de
State In Next
Commit e309ce2ea662cce8070511ea44d8a9ecf1f75153
Headers show
Series
  • HWPoison: Refactor get page interface
Related show

Commit Message

Oscar Salvador Nov. 19, 2020, 10:57 a.m. UTC
get_hwpoison_page already drains pcplists, previously disabling
them when trying to grab a refcount.
We do not need shake_page to take care of it anymore.

Signed-off-by: Oscar Salvador <osalvador@suse.de>
---
 mm/memory-failure.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

HORIGUCHI NAOYA(堀口 直也) Nov. 20, 2020, 1:33 a.m. UTC | #1
On Thu, Nov 19, 2020 at 11:57:16AM +0100, Oscar Salvador wrote:
> get_hwpoison_page already drains pcplists, previously disabling
> them when trying to grab a refcount.
> We do not need shake_page to take care of it anymore.
> 
> Signed-off-by: Oscar Salvador <osalvador@suse.de>

Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Vlastimil Babka Nov. 26, 2020, 1:52 p.m. UTC | #2
On 11/19/20 11:57 AM, Oscar Salvador wrote:
> get_hwpoison_page already drains pcplists, previously disabling
> them when trying to grab a refcount.
> We do not need shake_page to take care of it anymore.
> 
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> ---
>   mm/memory-failure.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 512613e9a1bd..ad976e1c3178 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -263,8 +263,8 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
>   }
>   
>   /*
> - * When a unknown page type is encountered drain as many buffers as possible
> - * in the hope to turn the page into a LRU or free page, which we can handle.
> + * Unknown page type encountered. Try to check whether it can turn PageLRU by
> + * lru_add_drain_all, or a free page by reclaiming slabs when possible.
>    */
>   void shake_page(struct page *p, int access)
>   {
> @@ -275,9 +275,6 @@ void shake_page(struct page *p, int access)
>   		lru_add_drain_all();
>   		if (PageLRU(p))
>   			return;
> -		drain_all_pages(page_zone(p));
> -		if (PageLRU(p) || is_free_buddy_page(p))
> -			return;

I wonder if page in the lru pagevec can in fact become free after draining the 
lru - in that case we could keep the is_free_buddy_page() check.

>   	}
>   
>   	/*
>
Oscar Salvador Nov. 27, 2020, 7:20 a.m. UTC | #3
On Thu, Nov 26, 2020 at 02:52:32PM +0100, Vlastimil Babka wrote:
> > @@ -275,9 +275,6 @@ void shake_page(struct page *p, int access)
> >   		lru_add_drain_all();
> >   		if (PageLRU(p))
> >   			return;
> > -		drain_all_pages(page_zone(p));
> > -		if (PageLRU(p) || is_free_buddy_page(p))
> > -			return;
> 
> I wonder if page in the lru pagevec can in fact become free after draining
> the lru - in that case we could keep the is_free_buddy_page() check.

Uhm, yes, I think it can happen.
After all, once the page hits one of the inactives' LRU it can be
reclaimed.

I am fine with joining the left PageLRU and is_free_buddy_page check.

Will do that in the next revision.

Thanks!

Patch
diff mbox series

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 512613e9a1bd..ad976e1c3178 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -263,8 +263,8 @@  static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
 }
 
 /*
- * When a unknown page type is encountered drain as many buffers as possible
- * in the hope to turn the page into a LRU or free page, which we can handle.
+ * Unknown page type encountered. Try to check whether it can turn PageLRU by
+ * lru_add_drain_all, or a free page by reclaiming slabs when possible.
  */
 void shake_page(struct page *p, int access)
 {
@@ -275,9 +275,6 @@  void shake_page(struct page *p, int access)
 		lru_add_drain_all();
 		if (PageLRU(p))
 			return;
-		drain_all_pages(page_zone(p));
-		if (PageLRU(p) || is_free_buddy_page(p))
-			return;
 	}
 
 	/*