Re: [PATCH v4 3/6] mm: migrate: split folio_migrate_mapping()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2024/6/6 8:54, Jane Chu wrote:
[..]
-int folio_migrate_mapping(struct address_space *mapping,
-		struct folio *newfolio, struct folio *folio, int extra_count)
+static void __folio_migrate_mapping(struct address_space *mapping,
+		struct folio *newfolio, struct folio *folio, int expected_cnt)
  {
  	XA_STATE(xas, &mapping->i_pages, folio_index(folio));
  	struct zone *oldzone, *newzone;
-	int dirty;
-	int expected_count = folio_expected_refs(mapping, folio) + extra_count;
  	long nr = folio_nr_pages(folio);
  	long entries, i;
+	int dirty;
if (!mapping) {
-		/* Anonymous page without mapping */

If 'mapping' was NULL, the first line would blow up while dereferencing 'mapping->i_pages'.

0->i_pages is wrong, but &(0->i_pages) is legal, and then xas->xa = NULL.

The ordering change was introduced by commit

89eb946a7432b "(mm: Convert page migration to XArray)"

Matthew, please correct me if I'm missing something.

thanks,

-jane





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux