diff mbox series

mm: Remove redundant condition for THP folio

Message ID 20241018094151.3458-1-dev.jain@arm.com (mailing list archive)
State New
Headers show
Series mm: Remove redundant condition for THP folio | expand

Commit Message

Dev Jain Oct. 18, 2024, 9:41 a.m. UTC
folio_test_pmd_mappable() implies folio_test_large(), therefore,
simplify the expression for is_thp.

Signed-off-by: Dev Jain <dev.jain@arm.com>
---
 mm/migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Matthew Wilcox Oct. 18, 2024, 10:48 a.m. UTC | #1
On Fri, Oct 18, 2024 at 03:11:51PM +0530, Dev Jain wrote:
> folio_test_pmd_mappable() implies folio_test_large(), therefore,
> simplify the expression for is_thp.
> 
> Signed-off-by: Dev Jain <dev.jain@arm.com>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
David Hildenbrand Oct. 18, 2024, 10:50 a.m. UTC | #2
On 18.10.24 11:41, Dev Jain wrote:
> folio_test_pmd_mappable() implies folio_test_large(), therefore,
> simplify the expression for is_thp.
> 
> Signed-off-by: Dev Jain <dev.jain@arm.com>
> ---
>   mm/migrate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index df91248755e4..b43e7b105559 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1731,7 +1731,7 @@ static int migrate_pages_batch(struct list_head *from,
>   
>   		list_for_each_entry_safe(folio, folio2, from, lru) {
>   			is_large = folio_test_large(folio);
> -			is_thp = is_large && folio_test_pmd_mappable(folio);
> +			is_thp = folio_test_pmd_mappable(folio);
>   			nr_pages = folio_nr_pages(folio);
>   
>   			cond_resched();

Acked-by: David Hildenbrand <david@redhat.com>
Zi Yan Oct. 18, 2024, 3:58 p.m. UTC | #3
On 18 Oct 2024, at 5:41, Dev Jain wrote:

> folio_test_pmd_mappable() implies folio_test_large(), therefore,
> simplify the expression for is_thp.
>
> Signed-off-by: Dev Jain <dev.jain@arm.com>
> ---
>  mm/migrate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

LGTM. Thanks. Reviewed-by: Zi Yan <ziy@nvidia.com>

Best Regards,
Yan, Zi
Anshuman Khandual Oct. 22, 2024, 5:23 a.m. UTC | #4
On 10/18/24 15:11, Dev Jain wrote:
> folio_test_pmd_mappable() implies folio_test_large(), therefore,
> simplify the expression for is_thp.
> 
> Signed-off-by: Dev Jain <dev.jain@arm.com>
> ---
>  mm/migrate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index df91248755e4..b43e7b105559 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1731,7 +1731,7 @@ static int migrate_pages_batch(struct list_head *from,
>  
>  		list_for_each_entry_safe(folio, folio2, from, lru) {
>  			is_large = folio_test_large(folio);
> -			is_thp = is_large && folio_test_pmd_mappable(folio);
> +			is_thp = folio_test_pmd_mappable(folio);
>  			nr_pages = folio_nr_pages(folio);
>  
>  			cond_resched();

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
diff mbox series

Patch

diff --git a/mm/migrate.c b/mm/migrate.c
index df91248755e4..b43e7b105559 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1731,7 +1731,7 @@  static int migrate_pages_batch(struct list_head *from,
 
 		list_for_each_entry_safe(folio, folio2, from, lru) {
 			is_large = folio_test_large(folio);
-			is_thp = is_large && folio_test_pmd_mappable(folio);
+			is_thp = folio_test_pmd_mappable(folio);
 			nr_pages = folio_nr_pages(folio);
 
 			cond_resched();