From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by kanga.kvack.org (Postfix) with ESMTP id 6C2B26B0005 for ; Fri, 11 Mar 2016 10:23:16 -0500 (EST) Received: by mail-wm0-f49.google.com with SMTP id n186so23339049wmn.1 for ; Fri, 11 Mar 2016 07:23:16 -0800 (PST) Subject: Re: [PATCH 16/18] drm/i915: make i915_gem_mmap_ioctl wait for mmap_sem killable References: <1456752417-9626-1-git-send-email-mhocko@kernel.org> <1456752417-9626-17-git-send-email-mhocko@kernel.org> From: Vlastimil Babka Message-ID: <56E2E2DC.9010806@suse.cz> Date: Fri, 11 Mar 2016 16:23:08 +0100 MIME-Version: 1.0 In-Reply-To: <1456752417-9626-17-git-send-email-mhocko@kernel.org> Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Michal Hocko , LKML Cc: Andrew Morton , linux-mm@kvack.org, Alex Deucher , Alex Thorlton , Andrea Arcangeli , Andy Lutomirski , Benjamin LaHaise , =?UTF-8?Q?Christian_K=c3=b6nig?= , Daniel Vetter , Dave Hansen , David Airlie , Davidlohr Bueso , 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 , Michal Hocko On 02/29/2016 02:26 PM, Michal Hocko wrote: > From: Michal Hocko > > i915_gem_mmap_ioctl relies 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: Daniel Vetter > Cc: David Airlie > Signed-off-by: Michal Hocko Acked-by: Vlastimil Babka > --- > drivers/gpu/drm/i915/i915_gem.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index f68f34606f2f..a50136cbd332 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -1754,7 +1754,10 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, > struct mm_struct *mm = current->mm; > struct vm_area_struct *vma; > > - down_write(&mm->mmap_sem); > + if (down_write_killable(&mm->mmap_sem)) { > + drm_gem_object_unreference_unlocked(obj); > + return -EINTR; > + } > vma = find_vma(mm, addr); > if (vma) > vma->vm_page_prot = > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org