lkml.org 
[lkml]   [2016]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PACTH v1] mm, proc: Implement /proc/<pid>/totmaps
From
Date


On 2016-08-09 04:17 PM, Robert Foss wrote:
>>> +static int totmaps_proc_show(struct seq_file *m, void *data)
>>> +{
>>> + struct proc_maps_private *priv = m->private;
>>> + struct mm_struct *mm;
>>> + struct vm_area_struct *vma;
>>> + struct mem_size_stats *mss_sum = priv->mss;
>>> +
>>> + /* reference to priv->task already taken */
>>> + /* but need to get the mm here because */
>>> + /* task could be in the process of exiting */
>>> + mm = get_task_mm(priv->task);
>>> + if (!mm || IS_ERR(mm))
>>> + return -EINVAL;
>>> +
>>
>> That's not how it's done in smaps.
>
> Alright, I'll have to look into the difference between this approach and
> the smaps one.


I had a look at show_smaps(), and it's not entirely clear to me what the
advantage of doing it show_smaps() way.

mm = get_task_mm(priv->task) is needed to iterate through all of the
mappings. Is there a preferable way of doing that?

\
 
 \ /
  Last update: 2016-08-10 20:41    [W:0.090 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site