Re: [PATCH v10 2/8] mm/huge_memory: add two new (not yet used) functions for folio_split()

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

 



On 10 Mar 2025, at 12:30, Matthew Wilcox wrote:

> On Fri, Mar 07, 2025 at 12:39:55PM -0500, Zi Yan wrote:
>> +	for (index = new_nr_pages; index < nr_pages; index += new_nr_pages) {
>> +		struct page *head = &folio->page;
>> +		struct page *new_head = head + index;
>> +
>> +		/*
>> +		 * Careful: new_folio is not a "real" folio before we cleared PageTail.
>> +		 * Don't pass it around before clear_compound_head().
>> +		 */
>> +		struct folio *new_folio = (struct folio *)new_head;
> [...]
>> +		/* ->mapping in first and second tail page is replaced by other uses */
>> +		VM_BUG_ON_PAGE(new_nr_pages > 2 && new_head->mapping != TAIL_MAPPING,
>> +			       new_head);
>> +		new_head->mapping = head->mapping;
>> +		new_head->index = head->index + index;
>
> Why are you using new_head->mapping and ->index instead of new_folio?

Because of the “Careful” comment. But new_folio->* should be fine,
since it is the same as new_head. So I probably can replace all
new_head with new_folio except those VM_BUG_ON_PAGE checks?


Best Regards,
Yan, Zi




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux