lkml.org 
[lkml]   [2023]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3 2/5] mm: kmem: add direct objcg pointer to task_struct
On Wed, Oct 18, 2023 at 10:22 AM Roman Gushchin
<roman.gushchin@linux.dev> wrote:
>
[...]
> > > struct mem_cgroup *memcg;
> > > @@ -3008,19 +3054,26 @@ __always_inline struct obj_cgroup *get_obj_cgroup_from_current(void)
> > >
> > > if (in_task()) {
> > > memcg = current->active_memcg;
> > > + if (unlikely(memcg))
> > > + goto from_memcg;
> > >
> > > - /* Memcg to charge can't be determined. */
> > > - if (likely(!memcg) && (!current->mm || (current->flags & PF_KTHREAD)))
> >
> > The checks for current->mm and PF_KTHREAD seem to be gone completely after
> > the patch, was that intended and why?
>
> There is no need for those anymore because it's as cheap or cheaper
> to check task->objcg for being NULL. Those were primarily used to rule out
> kernel threads allocations early.
>

I have the same understanding but please correct my suspicions here.
We can echo the kernel thread's pid to cgroup.procs which have
PF_NO_SETAFFINITY and thus this will cause the lower bit of the kernel
thread's task->objcg to be set. Please correct me if I am missing
something.

\
 
 \ /
  Last update: 2023-10-18 20:27    [W:0.093 / U:0.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site