Re: [PATCH 4/5] mm/vmscan: Convert shrink_active_list() to use a folio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 17, 2022 at 04:42:47PM +0100, Matthew Wilcox (Oracle) wrote:
> @@ -2478,23 +2477,21 @@ static void shrink_active_list(unsigned long nr_to_scan,
>  
>  	while (!list_empty(&l_hold)) {
>  		struct folio *folio;
> -		struct page *page;
>  
>  		cond_resched();
>  		folio = lru_to_folio(&l_hold);
>  		list_del(&folio->lru);
> -		page = &folio->page;
>  
> -		if (unlikely(!page_evictable(page))) {
> -			putback_lru_page(page);
> +		if (unlikely(!folio_evictable(folio))) {
> +			folio_putback_lru(folio);
>  			continue;
>  		}
>  
>  		if (unlikely(buffer_heads_over_limit)) {
> -			if (page_has_private(page) && trylock_page(page)) {
> -				if (page_has_private(page))
> -					try_to_release_page(page, 0);
> -				unlock_page(page);
> +			if (folio_get_private(folio) && folio_trylock(folio)) {
> +				if (folio_get_private(folio))
> +					filemap_release_folio(folio, 0);
> +				folio_unlock(folio);
>  			}
>  		}
>  

Hi Andrew.  Hugh points out that the above is not an equivalent
transformation for pages which are in the swapcache.  Can you apply
this fix, or would you like a full patch?

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0070c7fb600a..7e34f4c8d956 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2544,8 +2544,8 @@ static void shrink_active_list(unsigned long nr_to_scan,
 		}
 
 		if (unlikely(buffer_heads_over_limit)) {
-			if (folio_get_private(folio) && folio_trylock(folio)) {
-				if (folio_get_private(folio))
+			if (folio_test_private(folio) && folio_trylock(folio)) {
+				if (folio_test_private(folio))
 					filemap_release_folio(folio, 0);
 				folio_unlock(folio);
 			}




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux