From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:35125 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751300AbcCIKQy (ORCPT ); Wed, 9 Mar 2016 05:16:54 -0500 Date: Wed, 9 Mar 2016 11:16:52 +0100 From: Michal Hocko Subject: Re: [PATCH 09/18] ipc, shm: make shmem attach/detach wait for mmap_sem killable Message-ID: <20160309101651.GE27018@dhcp22.suse.cz> References: <1456752417-9626-1-git-send-email-mhocko@kernel.org> <1456752417-9626-10-git-send-email-mhocko@kernel.org> <20160308191550.GA4404@linux-uzut.site> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160308191550.GA4404@linux-uzut.site> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Davidlohr Bueso Cc: LKML , Andrew Morton , linux-mm@kvack.org, Alex Deucher , Alex Thorlton , Andrea Arcangeli , Andy Lutomirski , Benjamin LaHaise , Christian K?nig , Daniel Vetter , Dave Hansen , David Airlie , David Rientjes , "H . Peter Anvin" , Hugh Dickins , Ingo Molnar , Johannes Weiner , "Kirill A . Shutemov" , Konstantin Khlebnikov , linux-arch@vger.kernel.org, Mel Gorman , Oleg Nesterov , Peter Zijlstra , Petr Cermak , Thomas Gleixner Message-ID: <20160309101652.h50KoEeAh47HkL_NA15_8F-2M376xXFzn6l2EK26VtA@z> On Tue 08-03-16 11:15:50, Davidlohr Bueso wrote: > On Mon, 29 Feb 2016, Michal Hocko wrote: > > >From: Michal Hocko > > > >shmat and shmdt rely on mmap_sem for write. If the waiting task > >gets killed by the oom killer it would block oom_reaper from > >asynchronous address space reclaim and reduce the chances of timely > >OOM resolving. Wait for the lock in the killable mode and return with > >EINTR if the task got killed while waiting. > > > >Cc: Davidlohr Bueso > >Cc: Hugh Dickins > >Signed-off-by: Michal Hocko > > I have no objection to this perse, just one comment below. > > Acked-by: Davidlohr Bueso Thanks! [...] > >- down_write(¤t->mm->mmap_sem); > >+ if (down_write_killable(¤t->mm->mmap_sem)) { > >+ err = -EINVAL; > >+ goto out_fput; > >+ } > > This should be EINTR, no? Of course. Thanks for catching that. -- Michal Hocko SUSE Labs