Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1468617

Re: [PATCHv2 1/2] mm: introduce get_task_exe_file

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Mateusz Guzik <mguzik@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCHv2 1/2] mm: introduce get_task_exe_file
Date Tue, 23 Aug 2016 17:10:01 +0200
Message-ID <s9luV-5FE-27@gated-at.bofh.it> (permalink)
References <s9kSd-5aF-17@gated-at.bofh.it> <s9kSe-5aF-21@gated-at.bofh.it> <s9lbz-5jv-5@gated-at.bofh.it>
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
User-Agent Mutt/1.6.0.1 (2016-04-01)
X-Scanned-By MIMEDefang 2.68 on 10.5.11.22
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 23 Aug 2016 14:52:43 +0000 (UTC)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 40
Organization linux.* mail to news gateway
X-Original-Cc Konstantin Khlebnikov <khlebnikov@yandex-team.ru>, Richard Guy Briggs <rgb@redhat.com>, ebiederm@xmission.com, sgrubb@redhat.com, pmoore@redhat.com, eparis@redhat.com, luto@amacapital.net, linux-audit@redhat.com, linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
X-Original-Date Tue, 23 Aug 2016 16:52:36 +0200
X-Original-Message-ID <20160823145235.t3xs3fcf24qkaaw2@mguzik>
X-Original-References <1471962039-14940-1-git-send-email-mguzik@redhat.com> <1471962039-14940-2-git-send-email-mguzik@redhat.com> <20160823144812.GA2088@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1468617

Show key headers only | View raw


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

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCHv2 1/2] mm: introduce get_task_exe_file Mateusz Guzik <mguzik@redhat.com> - 2016-08-23 16:30 +0200
  Re: [PATCHv2 1/2] mm: introduce get_task_exe_file Oleg Nesterov <oleg@redhat.com> - 2016-08-23 16:50 +0200
    Re: [PATCHv2 1/2] mm: introduce get_task_exe_file Mateusz Guzik <mguzik@redhat.com> - 2016-08-23 17:10 +0200

csiph-web