diff mbox series

mm, compaction: avoid isolating pinned tmpfs pages

Message ID e2f0689e00cce7ac73716da14a971a4f1ab88359.1619618267.git.xuyu@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series mm, compaction: avoid isolating pinned tmpfs pages | expand

Commit Message

Xu Yu April 28, 2021, 2 p.m. UTC
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(-)

Comments

Xu Yu April 28, 2021, 2:06 p.m. UTC | #1
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;
>   
>
diff mbox series

Patch

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;