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 9:55, Matthew Wilcox wrote:
On Thu, Jun 06, 2024 at 09:24:37AM +0800, Kefeng Wang wrote:
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.

Uhh, it's not NULL, but it will be a small integer (offsetof(struct
address_space, i_pages)).

Oh, indeed, forget the offset, thanks.






[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