[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160229174739.GL16930@dhcp22.suse.cz>
Date: Mon, 29 Feb 2016 18:47:39 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
Alex Deucher <alexander.deucher@....com>,
Alex Thorlton <athorlton@....com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andy Lutomirski <luto@...capital.net>,
Benjamin LaHaise <bcrl@...ck.org>,
Christian König <christian.koenig@....com>,
Daniel Vetter <daniel.vetter@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
David Airlie <airlied@...ux.ie>,
Davidlohr Bueso <dave@...olabs.net>,
David Rientjes <rientjes@...gle.com>,
"H . Peter Anvin" <hpa@...or.com>, Hugh Dickins <hughd@...gle.com>,
Ingo Molnar <mingo@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Konstantin Khlebnikov <koct9i@...il.com>,
linux-arch@...r.kernel.org, Mel Gorman <mgorman@...e.de>,
Peter Zijlstra <peterz@...radead.org>,
Petr Cermak <petrcermak@...omium.org>,
Thomas Gleixner <tglx@...utronix.de>,
Alexander Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH 13/18] exec: make exec path waiting for mmap_sem killable
On Mon 29-02-16 18:23:34, Oleg Nesterov wrote:
> On 02/29, Michal Hocko wrote:
> >
> > @@ -267,7 +267,10 @@ static int __bprm_mm_init(struct linux_binprm *bprm)
> > if (!vma)
> > return -ENOMEM;
> >
> > - down_write(&mm->mmap_sem);
> > + if (down_write_killable(&mm->mmap_sem)) {
> > + err = -EINTR;
> > + goto err_free;
> > + }
> > vma->vm_mm = mm;
>
> I won't argue, but this looks unnecessary. Nobody else can see this new mm,
> down_write() can't block.
>
> In fact I think we can just remove down_write/up_write here. Except perhaps
> there is lockdep_assert_held() somewhere in these paths.
This is what I had initially but then I've noticed that mm_alloc() does
mm_init(current)->init_new_context(current) so the outside can see this
mm AFAICS. Now I guess this shouldn't matter in the real life but the
code doesn't seem much harder to follow, the callers are already
handling all error paths so I guess it would be better to simply move on
this. Or am I misunderstanding the code or missing something?
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists