Re: [PATCH v9 04/10] mm: split a folio in minimum folio order chunks

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

 



On 9 Jul 2024, at 7:04, Pankaj Raghav (Samsung) wrote:

>>
>> This should be
>>
>> 		if (!folio->mapping) {
>> 			if (folio_test_pmd_mappable(folio))
>> 				count_vm_event(THP_SPLIT_PAGE_FAILED);
>> 			return -EBUSY;
>> 		}
>>
>> Otherwise, a non PMD mappable folio with no mapping will fall through
>> and cause NULL pointer dereference in mapping_min_folio_order().
>
> Ah, of course. I thought I was being "smart" here to avoid another
> nesting. Instead of triple nested ifs, I guess this is better:
>
> int split_folio_to_list(struct folio *folio, struct list_head *list)
> {
>        unsigned int min_order = 0;
>
>        if (folio_test_anon(folio))
>                goto out;
>
>        if (!folio->mapping) {
>                if (folio_test_pmd_mappable(folio))
>                        count_vm_event(THP_SPLIT_PAGE_FAILED);
>                return -EBUSY;
>        }
>
>        min_order = mapping_min_folio_order(folio->mapping);
> out:
>        return split_huge_page_to_list_to_order(&folio->page, list,
>                                                        min_order);
> }
>
> Let me know what you think!

LGTM. Thanks. With this change, feel free to add Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>

--
Best Regards,
Yan, Zi

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux