Re: 回复: [PATCH v2] debugobjects: install cpu hotplug callback

From: Thomas Gleixner
Date: Fri Sep 04 2020 - 06:26:30 EST


On Fri, Sep 04 2020 at 07:50, Ingo Molnar wrote:
>> +#if defined(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);
>> + }
>> +
>> + return 0;
>> +}
>> +#endif
>
> What happens to ->obj_free, if the CPU is brought back online? Won't it be
> out of sync at that point?

Yes and it's going to do the completely wrong thing.

Thanks,

tglx