linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm, compaction: avoid isolating pinned tmpfs pages
@ 2021-04-28 14:00 Xu Yu
  2021-04-28 14:06 ` Yu Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Xu Yu @ 2021-04-28 14:00 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: akpm

This makes pinned tmpfs pages bail out early in the process of page
migration, like what pinned anonymous pages do.

Signed-off-by: Xu Yu <xuyu@linux.alibaba.com>
---
 mm/compaction.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index e04f4476e68e..78c3b992a1c9 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -964,11 +964,11 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
 		}
 
 		/*
-		 * Migration will fail if an anonymous page is pinned in memory,
-		 * so avoid taking lru_lock and isolating it unnecessarily in an
-		 * admittedly racy check.
+		 * Migration will fail if an anonymous or tmpfs page is pinned
+		 * in memory, so avoid taking lru_lock and isolating it
+		 * unnecessarily in an admittedly racy check.
 		 */
-		if (!page_mapping(page) &&
+		if (!page_is_file_lru(page) &&
 		    page_count(page) > page_mapcount(page))
 			goto isolate_fail;
 
-- 
2.20.1.2432.ga663e714


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm, compaction: avoid isolating pinned tmpfs pages
  2021-04-28 14:00 [PATCH] mm, compaction: avoid isolating pinned tmpfs pages Xu Yu
@ 2021-04-28 14:06 ` Yu Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Yu Xu @ 2021-04-28 14:06 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: akpm

On 4/28/21 10:00 PM, Xu Yu wrote:
> This makes pinned tmpfs pages bail out early in the process of page
> migration, like what pinned anonymous pages do.
> 
> Signed-off-by: Xu Yu <xuyu@linux.alibaba.com>
> ---
>   mm/compaction.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index e04f4476e68e..78c3b992a1c9 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -964,11 +964,11 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>   		}
>   
>   		/*
> -		 * Migration will fail if an anonymous page is pinned in memory,
> -		 * so avoid taking lru_lock and isolating it unnecessarily in an
> -		 * admittedly racy check.
> +		 * Migration will fail if an anonymous or tmpfs page is pinned
> +		 * in memory, so avoid taking lru_lock and isolating it
> +		 * unnecessarily in an admittedly racy check.
>   		 */
> -		if (!page_mapping(page) &&
> +		if (!page_is_file_lru(page) &&
>   		    page_count(page) > page_mapcount(page))
Sorry, this patch is flawed, since tmpfs page cache takes an extra page
count.

Please ignore this patch.

>   			goto isolate_fail;
>   
> 

-- 
Thanks,
Yu

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-28 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 14:00 [PATCH] mm, compaction: avoid isolating pinned tmpfs pages Xu Yu
2021-04-28 14:06 ` Yu Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).