* [PATCH] mm: Cleanup expected_page_refs()
@ 2019-02-07 11:23 Jan Kara
2019-02-07 18:33 ` Andrea Arcangeli
0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2019-02-07 11:23 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, Andrea Arcangeli, Jan Kara
Andrea has noted that page migration code propagates page_mapping(page)
through the whole migration stack down to migrate_page() function so it
seems stupid to then use page_mapping(page) in expected_page_refs()
instead of passed down 'mapping' argument. I agree so let's make
expected_page_refs() more in line with the rest of the migration stack.
Suggested-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
mm/migrate.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index d4fd680be3b0..fd2f7cec98ce 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -374,7 +374,7 @@ void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd)
}
#endif
-static int expected_page_refs(struct page *page)
+static int expected_page_refs(struct address_space *mapping, struct page *page)
{
int expected_count = 1;
@@ -384,7 +384,7 @@ static int expected_page_refs(struct page *page)
*/
expected_count += is_device_private_page(page);
expected_count += is_device_public_page(page);
- if (page_mapping(page))
+ if (mapping)
expected_count += hpage_nr_pages(page) + page_has_private(page);
return expected_count;
@@ -405,7 +405,7 @@ int migrate_page_move_mapping(struct address_space *mapping,
XA_STATE(xas, &mapping->i_pages, page_index(page));
struct zone *oldzone, *newzone;
int dirty;
- int expected_count = expected_page_refs(page) + extra_count;
+ int expected_count = expected_page_refs(mapping, page) + extra_count;
if (!mapping) {
/* Anonymous page without mapping */
@@ -750,7 +750,7 @@ static int __buffer_migrate_page(struct address_space *mapping,
return migrate_page(mapping, newpage, page, mode);
/* Check whether page does not have extra refs before we do more work */
- expected_count = expected_page_refs(page);
+ expected_count = expected_page_refs(mapping, page);
if (page_count(page) != expected_count)
return -EAGAIN;
--
2.16.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm: Cleanup expected_page_refs()
2019-02-07 11:23 [PATCH] mm: Cleanup expected_page_refs() Jan Kara
@ 2019-02-07 18:33 ` Andrea Arcangeli
0 siblings, 0 replies; 2+ messages in thread
From: Andrea Arcangeli @ 2019-02-07 18:33 UTC (permalink / raw)
To: Jan Kara; +Cc: Andrew Morton, linux-mm
Hello Jan,
On Thu, Feb 07, 2019 at 12:23:14PM +0100, Jan Kara wrote:
> Andrea has noted that page migration code propagates page_mapping(page)
> through the whole migration stack down to migrate_page() function so it
> seems stupid to then use page_mapping(page) in expected_page_refs()
> instead of passed down 'mapping' argument. I agree so let's make
> expected_page_refs() more in line with the rest of the migration stack.
>
> Suggested-by: Andrea Arcangeli <aarcange@redhat.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> mm/migrate.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Thanks,
Andrea
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-07 18:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-07 11:23 [PATCH] mm: Cleanup expected_page_refs() Jan Kara
2019-02-07 18:33 ` Andrea Arcangeli
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).