lkml.org 
[lkml]   [2016]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv2 1/2] mm: introduce get_task_exe_file
On Tue, Aug 23, 2016 at 04:48:13PM +0200, Oleg Nesterov wrote:
> On 08/23, Mateusz Guzik wrote:
> >
> > +struct file *get_task_exe_file(struct task_struct *task)
> > +{
> > + struct file *exe_file = NULL;
> > + struct mm_struct *mm;
> > +
> > + task_lock(task);
> > + mm = task->mm;
> > + if (mm) {
> > + if (!(task->flags & PF_KTHREAD))
> > + exe_file = get_mm_exe_file(mm);
> > + }
> > + task_unlock(task);
> > + return exe_file;
> > +}
>
> I can't believe I am going to comment the coding style but I can't resist ;)
>
> if (mm && !(task->flags & PF_KTHREAD)))
> exe_file = get_mm_exe_file(mm);
>
> looks a bit simpler to me. But this is purely cosmetic and subjective,
> both patches look good to me.
>

Actually I did it for some consistency with get_task_mm.

The check can likely be done prior to taking the lock in both functions
and that would clean them up a little bit, but I wanted to avoid nit
picking... :>

> Acked-by: Oleg Nesterov <oleg@redhat.com>
>

Thanks

--
Mateusz Guzik

\
 
 \ /
  Last update: 2016-09-17 09:57    [W:0.038 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site