Re: [PATCH] mm/memcg: Disable task obj_stock for PREEMPT_RT

From: Waiman Long
Date: Wed Aug 04 2021 - 12:00:54 EST


On 8/3/21 9:40 PM, Waiman Long wrote:
On 8/3/21 7:21 PM, Thomas Gleixner wrote:
To complete the analysis of drain_local_stock(). AFAICT that function
can only be called from task context. So what is the purpose of this
in_task() conditional there?

    if (in_task())
           drain_obj_stock(&stock->task_obj);
I haven't done a full analysis to see if it can be called from task context only. Maybe in_task() check isn't needed, but having it there provides the safety that it will still work in case it can be called from interrupt context.

After looking at possible call chains that can lead to drain_local_stock(), one call chain comes from the allocation of slab objects which I had previously determined to be callable from interrupt context. So it is prudent to add a in_task() check here.

Cheers,
Longman