Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1764426ybl; Thu, 15 Aug 2019 00:30:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2mC2bjO5FP70ZbxfERL+BzCqPOs2oHNXJr50xUDnJeP+/YPhJxV31Pw8qd4NumMHFMFJS X-Received: by 2002:a17:90a:a008:: with SMTP id q8mr1050869pjp.114.1565854214629; Thu, 15 Aug 2019 00:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565854214; cv=none; d=google.com; s=arc-20160816; b=XMigwW6n1QBgW/niZ9opA1G5p4GXWMFP5FqNQ6HSe74wCWSCduEYdwuwZlMp6c/e3X SE9b5ObWT+caBLTK9AQaUDnc3lSA+S5GjcLwM6iJe63sEgxqz4jseHnUrxDAjsm/SW6k hWB6qLgecXOpEQh8O0E4+miHb4rzKxBPZdu9/O/AYeZnDcOA3k2v8RglgcKMy7/zBu0R gPzngUJbSV9S5W8vQR+LIc6hZM8TP6lg73tAyhasoEo5v4TxIP7pjlIT0lTNdyTFJZaf y0lMi1B230XiZ4x2gQFhgbf/eBe0qiWAWZC7OIZM3OZS+BWbG/5wpxU7vwa/U13gJ11D wB5Q== 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-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=AdThTK4irWjRHbKRNPRojupEGI8CuxNqyMHUGO6haU0=; b=Wwle0BcowzPdr6vhXKAGnH+kCEgu9hv355RKZxv/UPkDJlPtNPtB1KUJXrhQQ34yri kBXAVLhOKhZ2qMK0MU0rme6xrCqNkX0KRyWYYO4pA7QSXrptMIHBR/0cRVxvh4U+RJBI JAa0Cjdsh5ol9H29zCZz7IjiIB5fNUIdKJbEEVwHzItS1GV7ClamH7mtzXmOSEN6HOyV peMxXBYNzu+zXvO4NwtUs+Na/rmx70stIFXJBJIP7sCQT/CsbFmmPHF1uGbjBjO/wAXj vPyiON1oDk2g6hE61S8dvNyyPXCBWcF5XaMnzktDFpSxeSO0pXa4RBmIAMHWwc5kXxRl /cYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=YBWFagRx; 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 k30si1491164pfp.284.2019.08.15.00.29.59; Thu, 15 Aug 2019 00:30:14 -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=@ffwll.ch header.s=google header.b=YBWFagRx; 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 S1728786AbfHOGw0 (ORCPT + 99 others); Thu, 15 Aug 2019 02:52:26 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:45377 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbfHOGw0 (ORCPT ); Thu, 15 Aug 2019 02:52:26 -0400 Received: by mail-ed1-f68.google.com with SMTP id x19so1273784eda.12 for ; Wed, 14 Aug 2019 23:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=AdThTK4irWjRHbKRNPRojupEGI8CuxNqyMHUGO6haU0=; b=YBWFagRxj3AfoQNeT1UBuJe04QemjMpngCbeoAlxYRV7G8aAfyWVf43ySnd4OGigxl Ns4xbcsW7Azu5FyzHwpJgyFbWPQVJjetlQmlGonoYkSnreGT+4qCoMjbqjRsUQV31Hvp z9jyRdBKqwQdDr3jRTT1T/yIfgsHR8yJHCyq0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=AdThTK4irWjRHbKRNPRojupEGI8CuxNqyMHUGO6haU0=; b=j0D72ASffdqk9F3nlMVnPfcC6N2XPZ3glgI7wZQJlgyV2Oc50wfC8byAdTcKqjnPRx cOWicgu4T7QXjAbzb7cA74yk9JOpt0MXt8vB2AF4yb+CpjYa7lhnVG1TQ/j6ONbQRbPm cD++tlrku+r6Tp3n4tufRel86DMBCELXRBp8XKa0g4EMJWh5RGdIBYTsB0GLCsY2klMm WKGDek/FOImNT3yZfS37eYyvX64xrJiYC15s9v/+1ICYpirhkN1k9uXu6K1CBwA8b4vl U3lrtUmwGVuIb4AjNaaXMgViwYHwDgtxucfQMUEAUAy/TcYocNBFWlFMLrcdvFGuDIu6 eUnA== X-Gm-Message-State: APjAAAVK0cRS2Kvj2yfkxfsDJDxmHiIz0AY443ia9REOZSygY0dBmh+/ 3L5KqHPzRHK9zAntN+fPVxoKKQ== X-Received: by 2002:a50:a485:: with SMTP id w5mr3690508edb.277.1565851944641; Wed, 14 Aug 2019 23:52:24 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id w3sm391183edu.4.2019.08.14.23.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 23:52:23 -0700 (PDT) Date: Thu, 15 Aug 2019 08:52:21 +0200 From: Daniel Vetter To: Andrew Morton Cc: Daniel Vetter , 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?B?Suly9G1l?= 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: <20190815065221.GZ7444@phenom.ffwll.local> Mail-Followup-To: Andrew Morton , 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?B?Suly9G1l?= Glisse , Masahiro Yamada , Wei Wang , Andy Shevchenko , Thomas Gleixner , Jann Horn , Feng Tang , Kees Cook , Randy Dunlap , Daniel Vetter References: <20190814202027.18735-1-daniel.vetter@ffwll.ch> <20190814202027.18735-3-daniel.vetter@ffwll.ch> <20190814134558.fe659b1a9a169c0150c3e57c@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190814134558.fe659b1a9a169c0150c3e57c@linux-foundation.org> X-Operating-System: Linux phenom 4.19.0-5-amd64 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 Wed, Aug 14, 2019 at 01:45:58PM -0700, Andrew Morton wrote: > 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. I agree on both points, but I guess I'm not the expert to explain why we have this. All I'm trying to do is that drivers hold up their side. If you want to have better documentation for why the oom case needs this special new mode, you're looking at the wrong guy for that :-) Of course if you folks all decide that you just don't want to be remembered about that I guess we can drop this one here, but you're just shooting the messenger I think. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch