lkml.org 
[lkml]   [2022]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 4/4] mm: kmemleak: kmemleak_*_phys() set address type and check PA when scan
From


On 2022/6/6 23:29, Catalin Marinas wrote:
> On Fri, Jun 03, 2022 at 11:54:15AM +0800, Patrick Wang wrote:
>> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
>> index 246a70b7218f..62d1ad8f8a44 100644
>> --- a/mm/kmemleak.c
>> +++ b/mm/kmemleak.c
>> @@ -1156,8 +1156,12 @@ EXPORT_SYMBOL(kmemleak_no_scan);
>> void __ref kmemleak_alloc_phys(phys_addr_t phys, size_t size, int min_count,
>> gfp_t gfp)
>> {
>> - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn)
>> - kmemleak_alloc(__va(phys), size, min_count, gfp);
>> + pr_debug("%s(0x%pa, %zu, %d)\n", __func__, &phys, size, min_count);
>> +
>> + if (kmemleak_enabled && !min_count)
>> + /* create object with OBJECT_PHYS flag */
>> + create_object((unsigned long)phys, size, min_count,
>> + gfp, true);
>> }
>
> With an early patch, just drop min_count altogether from this API,
> assume 0.

Will do.

>
>> EXPORT_SYMBOL(kmemleak_alloc_phys);
>>
>> @@ -1170,8 +1174,10 @@ EXPORT_SYMBOL(kmemleak_alloc_phys);
>> */
>> void __ref kmemleak_free_part_phys(phys_addr_t phys, size_t size)
>> {
>> - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn)
>> - kmemleak_free_part(__va(phys), size);
>> + pr_debug("%s(0x%pa)\n", __func__, &phys);
>> +
>> + if (kmemleak_enabled)
>> + delete_object_part((unsigned long)phys, size, true);
>> }
>> EXPORT_SYMBOL(kmemleak_free_part_phys);
>>
>> @@ -1182,8 +1188,10 @@ EXPORT_SYMBOL(kmemleak_free_part_phys);
>> */
>> void __ref kmemleak_not_leak_phys(phys_addr_t phys)
>> {
>> - if (PHYS_PFN(phys) >= min_low_pfn && PHYS_PFN(phys) < max_low_pfn)
>> - kmemleak_not_leak(__va(phys));
>> + pr_debug("%s(0x%pa)\n", __func__, &phys);
>> +
>> + if (kmemleak_enabled)
>> + make_gray_object((unsigned long)phys, true);
>> }
>> EXPORT_SYMBOL(kmemleak_not_leak_phys);
>
> This function doesn't have any callers, so please remove it.

Will do.

Thanks,
Patrick

\
 
 \ /
  Last update: 2022-06-07 16:38    [W:0.077 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site