History

mm/migrate.c: cleanup expected_page_refs()

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.

Jan Kara committed 7 years ago

Commit f9004821 parent a862f681 file · +4 −4Browse files

Unified · Split

mm/migrate.c+4−4
@@ -374,7 +374,7 @@ unlock: · 373 unmodified lines
374}374}
375#endif375#endif
376 376
377static int expected_page_refs(struct page *page)377static int expected_page_refs(struct address_space *mapping, struct page *page)
378{378{
379 int expected_count = 1;379 int expected_count = 1;
380 380
@@ -384,7 +384,7 @@ static int expected_page_refs(struct page *page) · 3 unmodified lines
384 */384 */
385 expected_count += is_device_private_page(page);385 expected_count += is_device_private_page(page);
386 expected_count += is_device_public_page(page);386 expected_count += is_device_public_page(page);
387 if (page_mapping(page))387 if (mapping)
388 expected_count += hpage_nr_pages(page) + page_has_private(page);388 expected_count += hpage_nr_pages(page) + page_has_private(page);
389 389
390 return expected_count;390 return expected_count;
@@ -405,7 +405,7 @@ int migrate_page_move_mapping(struct address_space *mapping, · 14 unmodified lines
405 XA_STATE(xas, &mapping->i_pages, page_index(page));405 XA_STATE(xas, &mapping->i_pages, page_index(page));
406 struct zone *oldzone, *newzone;406 struct zone *oldzone, *newzone;
407 int dirty;407 int dirty;
408 int expected_count = expected_page_refs(page) + extra_count;408 int expected_count = expected_page_refs(mapping, page) + extra_count;
409 409
410 if (!mapping) {410 if (!mapping) {
411 /* Anonymous page without mapping */411 /* Anonymous page without mapping */
@@ -750,7 +750,7 @@ static int __buffer_migrate_page(struct address_space *mapping, · 338 unmodified lines
750 return migrate_page(mapping, newpage, page, mode);750 return migrate_page(mapping, newpage, page, mode);
751 751
752 /* Check whether page does not have extra refs before we do more work */752 /* Check whether page does not have extra refs before we do more work */
753 expected_count = expected_page_refs(page);753 expected_count = expected_page_refs(mapping, page);
754 if (page_count(page) != expected_count)754 if (page_count(page) != expected_count)
755 return -EAGAIN;755 return -EAGAIN;
756 756

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t