lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc7702c8-6d85-66ee-3220-8c1a3e9acf0b@redhat.com>
Date:   Wed, 9 Sep 2020 22:50:27 -0400
From:   Waiman Long <longman@...hat.com>
To:     "Zhang, Qiang" <Qiang.Zhang@...driver.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...nel.org" <mingo@...nel.org>,
        "elver@...gle.com" <elver@...gle.com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: 回复: [PATCH v3] debugobjects: install CPU hotplug callback

On 9/9/20 9:48 PM, Zhang, Qiang wrote:
>
> ________________________________________
> 发件人: Waiman Long <longman@...hat.com>
> 发送时间: 2020年9月9日 2:23
> 收件人: Zhang, Qiang; tglx@...utronix.de; mingo@...nel.org; elver@...gle.com
> 抄送: linux-kernel@...r.kernel.org
> 主题: Re: [PATCH v3] debugobjects: install CPU hotplug callback
>
> On 9/8/20 2:27 AM, qiang.zhang@...driver.com wrote:
>> From: Zqiang <qiang.zhang@...driver.com>
>>
>> Due to CPU hotplug, it may never be online after it's offline,
>> some objects in percpu pool is never free. in order to avoid
>> this happening, install CPU hotplug callback, call this callback
>> func to free objects in percpu pool when CPU going offline.
>>
>> Signed-off-by: Zqiang <qiang.zhang@...driver.com>
>> ---
>>    v1->v2:
>>    Modify submission information.
>>
>>    v2->v3:
>>    In CPU hotplug callback func, add clear percpu pool "obj_free" operation.
>>    capitalize 'CPU', and use shorter preprocessor sequence.
>>
>>    include/linux/cpuhotplug.h |  1 +
>>    lib/debugobjects.c         | 24 ++++++++++++++++++++++++
>>    2 files changed, 25 insertions(+)
>>
>> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
>> index 3215023d4852..0c39d57e5342 100644
>> --- a/include/linux/cpuhotplug.h
>> +++ b/include/linux/cpuhotplug.h
>> @@ -36,6 +36,7 @@ enum cpuhp_state {
>>        CPUHP_X86_MCE_DEAD,
>>        CPUHP_VIRT_NET_DEAD,
>>        CPUHP_SLUB_DEAD,
>> +     CPUHP_DEBUG_OBJ_DEAD,
>>        CPUHP_MM_WRITEBACK_DEAD,
>>        CPUHP_MM_VMSTAT_DEAD,
>>        CPUHP_SOFTIRQ_DEAD,
>> diff --git a/lib/debugobjects.c b/lib/debugobjects.c
>> index fe4557955d97..bb69a02c3e7b 100644
>> --- a/lib/debugobjects.c
>> +++ b/lib/debugobjects.c
>> @@ -19,6 +19,7 @@
>>    #include <linux/slab.h>
>>    #include <linux/hash.h>
>>    #include <linux/kmemleak.h>
>> +#include <linux/cpu.h>
>>
>>    #define ODEBUG_HASH_BITS    14
>>    #define ODEBUG_HASH_SIZE    (1 << ODEBUG_HASH_BITS)
>> @@ -433,6 +434,24 @@ static void free_object(struct debug_obj *obj)
>>        }
>>    }
>>
>> +#ifdef CONFIG_HOTPLUG_CPU
>> +static int object_cpu_offline(unsigned int cpu)
>> +{
>> +     struct debug_percpu_free *percpu_pool;
>> +     struct hlist_node *tmp;
>> +     struct debug_obj *obj;
>> +
>> +     percpu_pool = per_cpu_ptr(&percpu_obj_pool, cpu);
>> +     hlist_for_each_entry_safe(obj, tmp, &percpu_pool->free_objs, node) {
>> +             hlist_del(&obj->node);
>> +             kmem_cache_free(obj_cache, obj);
>> +     }
>> +     percpu_pool->obj_free = 0;
>>> For pointer, it is better to use NULL for clarity.
>>> Cheers,
>>> Longman
> Do you mean "->obj_free" variable ?   this represents the number of free objects in  percpu_pool .
>
You are right. I got confused. Sorry for the noise.

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ