Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1272850ybl; Wed, 14 Aug 2019 13:51:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4a77zWpzfB+XLWbvS/iWaVsNSFmzFSvI+yHnoARDA3Gl2phH5VBqTI9KU+wggqkbdVASz X-Received: by 2002:a63:20d:: with SMTP id 13mr859612pgc.253.1565815916994; Wed, 14 Aug 2019 13:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565815916; cv=none; d=google.com; s=arc-20160816; b=iYx6c8cZmpmBMrEkPeNM97WCIThX17oBxBDXnpchHJbvs2q5cNf5/I9iZ73u8StbU9 NDhART21B8kaoTZJSUSJ5dlNppNGjVdcW4Kwg/ixaZceDH7wO2Zqg7M03tPTaYOhiVXr YZTscReBAekPvZ6qsYZdudBQ5PsOo+A7ex/SUX1rwdctAcWNolBeYln3BLp64p2PNS61 SvSq0ZYVc1hDmSs2r/fHtuHvjixh/IylzD99WQSU1O9BEOFmfqHefhgQ+j78oUfGL0hz eNZu5xLl1v2BR1fMZSsvI0oYPtkihFJkInmewPQvUmXyk9Eske0cdHL4foiIBsBIvQhO Q0vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=K3LsKPP2AWuqN1iqUx8NOnr9aS7R7njEn7Ynu+2o1w8=; b=Vak6g2C8Gusvk9eTnxistb4vRS9INLTjRoVckL1FzpqJzsatxqumHlZ/JC12Pc7oOF GQFYCfhWnTSiY7lEN1dAcGUB+RQtPLN28bTaQ9/jleOlB/TL2Wa7YWP8eDU4DUOZv9Of SmR7Gu0bNK4+S16cRSVgu2iXaqNa12Q535F2yTdrsqUuGRqGAuN+B6G99VatAGy6HmMF 1S1w1b5uPcd2U1DNF5f5w0AypgBTRNLpoUCayW+t34VatPz9ONpSfPUi3Alli0qhagD+ auZmN0cJydy30JbJB5mONWq7XhUYv9xwEnQc0feyRpkc4ea17l8VVDV97UQn6+kpwoUM 1Oeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C8M74AF9; 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 c13si486446pjo.75.2019.08.14.13.51.40; Wed, 14 Aug 2019 13:51:56 -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=pass header.i=@kernel.org header.s=default header.b=C8M74AF9; 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 S1729853AbfHNUqA (ORCPT + 99 others); Wed, 14 Aug 2019 16:46:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:34046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbfHNUqA (ORCPT ); Wed, 14 Aug 2019 16:46:00 -0400 Received: from localhost.localdomain (c-73-223-200-170.hsd1.ca.comcast.net [73.223.200.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9B1AC216F4; Wed, 14 Aug 2019 20:45:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565815559; bh=EZBLwiP0N1eStQ84ag5nDU6Qw/MvJKG//W915vWDF64=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=C8M74AF9gR0yIHtwYXvV9mYooDdtRaEbsAeu6xdcjm7MiFRBUgOgksIa9IbyRynX1 8CovqClt4Zok7omZXMvrQ3krCm6iGcZ0/itlgYZhj1RoQID2VjQjF4gGY4TQptnckQ TYHTpL4yrQVOBgTIBym0nVj3v8+ixtaD2yCXXF1c= Date: Wed, 14 Aug 2019 13:45:58 -0700 From: Andrew Morton To: Daniel Vetter Cc: LKML , linux-mm@kvack.org, DRI Development , Intel Graphics Development , Jason Gunthorpe , Peter Zijlstra , Ingo Molnar , Michal Hocko , David Rientjes , Christian =?ISO-8859-1?Q?K=F6nig?= , =?ISO-8859-1?Q?J=E9r?= =?ISO-8859-1?Q?=F4me?= Glisse , Masahiro Yamada , Wei Wang , Andy Shevchenko , Thomas Gleixner , Jann Horn , Feng Tang , Kees Cook , Randy Dunlap , Daniel Vetter Subject: Re: [PATCH 2/5] kernel.h: Add non_block_start/end() Message-Id: <20190814134558.fe659b1a9a169c0150c3e57c@linux-foundation.org> In-Reply-To: <20190814202027.18735-3-daniel.vetter@ffwll.ch> References: <20190814202027.18735-1-daniel.vetter@ffwll.ch> <20190814202027.18735-3-daniel.vetter@ffwll.ch> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Aug 2019 22:20:24 +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. I continue to struggle with this. It introduces a new kernel state "running preemptibly but must not call schedule()". How does this make any sense? Perhaps a much, much more detailed description of the oom_reaper situation would help out.