On Fri, Aug 25, 2023 at 9:15 AM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@nec.com> wrote:
>>> -     if (!task_mm(task, TRUE))
>>> +     if (!(addr = task_mm(task, TRUE)))
>>> +             return;
>>> +
>>> +     if (!readmem(addr + OFFSET(mm_struct_mm_count), KVADDR, &mm_count,
>>> +             sizeof(int), "mm_struct mm_count", RETURN_ON_ERROR))
>>> +             return;

tt->mm_struct is filled in task_mm(), I think we can use this:

   mm_count = INT(tt->mm_struct + OFFSET(mm_struct_mm_count));

The following code in get_task_mem_usage() also use this.

Good idea. I will post v2 with this change later.

Thanks.
Lianbo
 

Thanks,
Kazu