Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp481201ybl; Fri, 23 Aug 2019 03:56:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtzWCPOXx3kpspsSRv9Ffqi7iiwzAqdPqShRnzNblIRH9g57EF1X+ZQ6SeXwkH8nQWwA8s X-Received: by 2002:aa7:98da:: with SMTP id e26mr4567106pfm.34.1566557815185; Fri, 23 Aug 2019 03:56:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566557815; cv=none; d=google.com; s=arc-20160816; b=Z6B5IivLpEPGe17nYJod8qzVtXyeTnzZd7S1p5dNppUBfrKt/xoIElqkw9aNRaovbV zigynYKjEvxXY0bi8hvLRMIceLUSk6aYBDd34IHNn7h+zhQih/A9OrGU2uicYOWWeJqg 1oyKUGuH+EsMF4k/VXrdc9C3Z8drTmmrsLlUNyYbwUM/X1o+V+hmOTYdJ5xmyGTsM50Q MHQo8yX4T83GVB0ns0WDdSTHi77jL/kMdjqe4qTb4Gsqe0pq9IUrYFwjYqcHrqE/7jUY lkG6gz9Fu0scri0bcW56j2s9cwrbaJBTUC9Ug7sRD42f8Sagyspf0jipb3Z08Fim/SFx c5Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature; bh=7s9/nci+zKyvrE92H9Lp/Liq0lrM5HNKhcwL7sRJw+4=; b=tGxqBl9MlsyHEYVF3H5L5gnByPcS8LLH7XiYlgKL8aH/6duZjAiE4T6LqcT8tvv2Xj gHEf0Rt+tOwIwiE4GNcXkWqrNif5j7DwcXFGP6U5MGc40dAHWR9loWe50S4ddWD3fZHI 7Le52s+sx2hqpKb/iPhIjPjnSJBo/ZF/DTjXfIysZdvk51+dQJHyWkQjtbnXNFd6XMXh 6JmmhaUqmamrBGmI5aGi8Wkjxs4MXDERfhbNmi71TvXD9h6TFakQZN5pYSoy2sSihwaQ 5JAA0bb4pel1AJN7I2zURl2LUE/b3eAKfivkSNX8XmpdXkkC5ayAwEvYg56lqF1B0add gA4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=P6eKagAL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v19si1951822pjn.96.2019.08.23.03.56.39; Fri, 23 Aug 2019 03:56:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=P6eKagAL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393047AbfHWIsa (ORCPT + 99 others); Fri, 23 Aug 2019 04:48:30 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55256 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732418AbfHWIsa (ORCPT ); Fri, 23 Aug 2019 04:48:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7s9/nci+zKyvrE92H9Lp/Liq0lrM5HNKhcwL7sRJw+4=; b=P6eKagALn8nMspRlT5ktoTdyRi EJMa61U6Y0iSY8RaLjdPRr77ly3h6vUScMsTZrWkUBrBqE3vXFEvaoagy2NMYcOpOJHcslrk5VKn2 2nroaMZss/Rv2u5Qaqh9AWTDRg0zOg4sqb3QW4/JUaO1luNcGy8Yt345WcvQIpkHW5/NBWKLbpfwW nsdaqhbiKoEyLRU4OzJeYFwB8Udi0RSzefldCm1Fhc/tVL9iYpB2NCqtJjhHL3Pi939WHS/qV1XN9 2lCLbOBIjA9+feGg4R8SM6OQa6s8WpBgzTEydowrpjEApaqiiLp6b/5ELAhy9r3SIMP+RjfnF9XaV UbGf8VRQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i15Et-0002rs-2t; Fri, 23 Aug 2019 08:48:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B3CE3307764; Fri, 23 Aug 2019 10:47:31 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DD53F20A21FCF; Fri, 23 Aug 2019 10:48:03 +0200 (CEST) Date: Fri, 23 Aug 2019 10:48:03 +0200 From: Peter Zijlstra To: LKML , Linux MM , DRI Development , Intel Graphics Development , Jason Gunthorpe , Ingo Molnar , Andrew Morton , Michal Hocko , David Rientjes , Christian =?iso-8859-1?Q?K=F6nig?= , =?iso-8859-1?B?Suly9G1l?= Glisse , Masahiro Yamada , Wei Wang , Andy Shevchenko , Thomas Gleixner , Jann Horn , Feng Tang , Kees Cook , Randy Dunlap , Daniel Vetter Subject: Re: [PATCH 3/4] kernel.h: Add non_block_start/end() Message-ID: <20190823084803.GD2369@hirez.programming.kicks-ass.net> References: <20190820081902.24815-1-daniel.vetter@ffwll.ch> <20190820081902.24815-4-daniel.vetter@ffwll.ch> <20190820202440.GH11147@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190820202440.GH11147@phenom.ffwll.local> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 20, 2019 at 10:24:40PM +0200, Daniel Vetter wrote: > On Tue, Aug 20, 2019 at 10:19:01AM +0200, Daniel Vetter wrote: > > In some special cases we must not block, but there's not a > > spinlock, preempt-off, irqs-off or similar critical section already > > that arms the might_sleep() debug checks. Add a non_block_start/end() > > pair to annotate these. > > > > This will be used in the oom paths of mmu-notifiers, where blocking is > > not allowed to make sure there's forward progress. Quoting Michal: > > > > "The notifier is called from quite a restricted context - oom_reaper - > > which shouldn't depend on any locks or sleepable conditionals. The code > > should be swift as well but we mostly do care about it to make a forward > > progress. Checking for sleepable context is the best thing we could come > > up with that would describe these demands at least partially." > > > > Peter also asked whether we want to catch spinlocks on top, but Michal > > said those are less of a problem because spinlocks can't have an > > indirect dependency upon the page allocator and hence close the loop > > with the oom reaper. > > > > Suggested by Michal Hocko. > > > > v2: > > - Improve commit message (Michal) > > - Also check in schedule, not just might_sleep (Peter) > > > > v3: It works better when I actually squash in the fixup I had lying > > around :-/ > > > > v4: Pick the suggestion from Andrew Morton to give non_block_start/end > > some good kerneldoc comments. I added that other blocking calls like > > wait_event pose similar issues, since that's the other example we > > discussed. > > > > Cc: Jason Gunthorpe > > Cc: Peter Zijlstra > > Cc: Ingo Molnar > > Cc: Andrew Morton > > Cc: Michal Hocko > > Cc: David Rientjes > > Cc: "Christian K?nig" > > Cc: Daniel Vetter > > Cc: "J?r?me Glisse" > > Cc: linux-mm@kvack.org > > Cc: Masahiro Yamada > > Cc: Wei Wang > > Cc: Andy Shevchenko > > Cc: Thomas Gleixner > > Cc: Jann Horn > > Cc: Feng Tang > > Cc: Kees Cook > > Cc: Randy Dunlap > > Cc: linux-kernel@vger.kernel.org > > Acked-by: Christian K?nig (v1) > > Signed-off-by: Daniel Vetter > > Hi Peter, > > Iirc you've been involved at least somewhat in discussing this. -mm folks > are a bit undecided whether these new non_block semantics are a good idea. > Michal Hocko still is in support, but Andrew Morton and Jason Gunthorpe > are less enthusiastic. Jason said he's ok with merging the hmm side of > this if scheduler folks ack. If not, then I'll respin with the > preempt_disable/enable instead like in v1. > > So ack/nack for this from the scheduler side? Right, I had memories of seeing this before, and I just found a fairly long discussion on this elsewhere in the vacation inbox (*groan*). Yeah, this is something I can live with, Acked-by: Peter Zijlstra (Intel)