Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752606AbdLKWYM (ORCPT ); Mon, 11 Dec 2017 17:24:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48920 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751347AbdLKWYL (ORCPT ); Mon, 11 Dec 2017 17:24:11 -0500 Subject: Re: [patch 1/2] mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks To: David Rientjes , Andrew Morton Cc: Michal Hocko , Andrea Arcangeli , Benjamin Herrenschmidt , Paul Mackerras , Oded Gabbay , Alex Deucher , =?UTF-8?Q?Christian_K=c3=b6nig?= , David Airlie , Joerg Roedel , Doug Ledford , Jani Nikula , Mike Marciniszyn , Sean Hefty , Dimitri Sivanich , Boris Ostrovsky , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: From: Paolo Bonzini Message-ID: <40828fec-a375-fb90-f4f1-fc647651c2f7@redhat.com> Date: Mon, 11 Dec 2017 23:23:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 11 Dec 2017 22:24:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1071 Lines: 24 On 11/12/2017 23:11, David Rientjes wrote: > Commit 4d4bbd8526a8 ("mm, oom_reaper: skip mm structs with mmu notifiers") > prevented the oom reaper from unmapping private anonymous memory with the > oom reaper when the oom victim mm had mmu notifiers registered. > > The rationale is that doing mmu_notifier_invalidate_range_{start,end}() > around the unmap_page_range(), which is needed, can block and the oom > killer will stall forever waiting for the victim to exit, which may not > be possible without reaping. > > That concern is real, but only true for mmu notifiers that have blockable > invalidate_range_{start,end}() callbacks. This patch adds a "flags" field > for mmu notifiers that can set a bit to indicate that these callbacks do > block. Why not put the flag in the ops, since the same ops should always be either blockable or unblockable? Paolo > The implementation is steered toward an expensive slowpath, such as after > the oom reaper has grabbed mm->mmap_sem of a still alive oom victim. > > Signed-off-by: David Rientjes