Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3228808imu; Sat, 24 Nov 2018 00:35:45 -0800 (PST) X-Google-Smtp-Source: AJdET5eJKKs/6QDzHm48BmhRA2695FpLxYc7mW5o8TeVtE6JaWSI7xTnvB5g/jNeCIgL71ZjKXv9 X-Received: by 2002:a63:d904:: with SMTP id r4mr17252082pgg.207.1543048544963; Sat, 24 Nov 2018 00:35:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543048544; cv=none; d=google.com; s=arc-20160816; b=DO9FuZwU5+9+vt3wTJ6Guddji76Vl2sZOqnWWXKWpHV3/qOvD4mCaRR0KoKKsaiqfV YQ+fIqIAdw1hrh5o/4O1rSQI10cxg8/sW/5IM3O1o1i5hhh4wsTCIcLGNpI1M+4CBBaa /Vd9iWBstD5xPcnvY1TR2fQu6KVGoy1Bjy6EXU5Ey3ANPDBoQYRk2hc8FfKkacdiFY1p s4SrAtaN0y2RvT44IGXuKi6z7CYxRDPqXmVeoe4gJAck3hY8oaMOkqbNZU9TJXUVt/hL x1TLYi2LvsL3RNsXZ5bSlOgxkrMTvivAy44nUFrQGw0nxIY//9Ig8tH/WG4z04a33i1e iD7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Pp/Z+h9nD1AtF0u37xW2WawLjTdUlyrsMPEdN1CHzEo=; b=snTaVZpxGUhE1Itd3stV/CIpkNuJFNeobbWFcsHS0CVlHRFeLb5hb+SuPDblUCPf5L kQoQYAVhVHPBwGrYTLMHRhtx+g2t02dEHVS+6EyJnmmbjk1kFycdFKFFjSxj0yT+mXsP ZOJbjDXtHwO+Ccv3QP0L46lqwcEkC2sl/J3MXBrEzt8oUKAf78g422+58zOmqOvfKIOx a58CUQSrntGq4VcUz8/tEtYb4OrVLm28QwXkp/s+UjmG5LWwykqY4voEs37+KPB4JwNT Ngb2exWNqmB4CFcdH4VPzMuAu/2DpaYu2JRcen2/HH+KBtpBL20gNIoztH4YuPBSUt+x XRrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="D/+LEI7I"; 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 129-v6si60536819pfy.164.2018.11.24.00.35.30; Sat, 24 Nov 2018 00:35:44 -0800 (PST) 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=@ffwll.ch header.s=google header.b="D/+LEI7I"; 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 S2504467AbeKWX5G (ORCPT + 99 others); Fri, 23 Nov 2018 18:57:06 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:41731 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390867AbeKWX5F (ORCPT ); Fri, 23 Nov 2018 18:57:05 -0500 Received: by mail-io1-f68.google.com with SMTP id s22so8748581ioc.8 for ; Fri, 23 Nov 2018 05:12:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Pp/Z+h9nD1AtF0u37xW2WawLjTdUlyrsMPEdN1CHzEo=; b=D/+LEI7IIRXnPuR0a/M22VHp9mzH7iOIWWTu9U8SS4O5lgoUkXa/uE/eAxLCuY7tUK 3xFnZ7cc9Ke9sOWiUVJ0TPKDQD00QI0bDIvyfRb39jC6iGET785xUfo9rvqBO9hbOGu8 Y5dR3YlJuRufmU9WcVrjxVtssX3YsjjE7MDUA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Pp/Z+h9nD1AtF0u37xW2WawLjTdUlyrsMPEdN1CHzEo=; b=meEoai/z5Ka7xA1W8kLH4EmKysb6wSDRY6Z48JRwK/PZTW86gvAi1Us3/58g+7DauT ClFzpPuTAkiNO+KEA4RpQiobci+g9tIlDGvRQl37Y2VmYAUiNFsjgcPLOWqeE71aCER5 zvw4ue/QX4m4RjrBC5gMY5rZPgwGP1l6zIExCOWH50D/l7aQI50uFWwUM98ts4TVLOBO 3XPZDUYKVtrz7LTNAZRxFBvkCbWULEsO+E7Fqo/8oCy0VqHaNnK/qjiJEBb0dFj0FbmY Wr22qbxIU8Ujwnv6CvJuGjRFoxaLaWWcHMCtt6mV0cLBWCNn8S1jS5VESp9fvivkpX1o ytvg== X-Gm-Message-State: AA+aEWbQfHPPdUInFtSTZXSM/5ir4jQlEw1kiDi47efMwF+3z5dJUSGq H2OC6JVUI2/sE4Ra4IICvYBNRh1Ezvr4Z8ZkqmbvqQ== X-Received: by 2002:a6b:b642:: with SMTP id g63-v6mr12326078iof.34.1542978776623; Fri, 23 Nov 2018 05:12:56 -0800 (PST) MIME-Version: 1.0 References: <20181122165106.18238-1-daniel.vetter@ffwll.ch> <20181122165106.18238-3-daniel.vetter@ffwll.ch> <20181123111237.GE8625@dhcp22.suse.cz> <20181123123838.GL4266@phenom.ffwll.local> <20181123124643.GK8625@dhcp22.suse.cz> In-Reply-To: <20181123124643.GK8625@dhcp22.suse.cz> From: Daniel Vetter Date: Fri, 23 Nov 2018 14:12:45 +0100 Message-ID: Subject: Re: [PATCH 2/3] mm, notifier: Catch sleeping/blocking for !blockable To: Michal Hocko Cc: Linux Kernel Mailing List , Linux MM , intel-gfx , dri-devel , Andrew Morton , David Rientjes , =?UTF-8?Q?Christian_K=C3=B6nig?= , Jerome Glisse , Daniel Vetter Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 23, 2018 at 1:46 PM Michal Hocko wrote: > > On Fri 23-11-18 13:38:38, Daniel Vetter wrote: > > On Fri, Nov 23, 2018 at 12:12:37PM +0100, Michal Hocko wrote: > > > On Thu 22-11-18 17:51:05, Daniel Vetter wrote: > > > > We need to make sure implementations don't cheat and don't have a > > > > possible schedule/blocking point deeply burried where review can't > > > > catch it. > > > > > > > > I'm not sure whether this is the best way to make sure all the > > > > might_sleep() callsites trigger, and it's a bit ugly in the code flow. > > > > But it gets the job done. > > > > > > Yeah, it is quite ugly. Especially because it makes DEBUG config > > > bahavior much different. So is this really worth it? Has this already > > > discovered any existing bug? > > > > Given that we need an oom trigger to hit this we're not hitting this in CI > > (oom is just way to unpredictable to even try). I'd kinda like to also add > > some debug interface so I can provoke an oom kill of a specially prepared > > process, to make sure we can reliably exercise this path without killing > > the kernel accidentally. We do similar tricks for our shrinker already. > > Create a task with oom_score_adj = 1000 and trigger the oom killer via > sysrq and you should get a predictable oom invocation and execution. Ah right. We kinda do that already in an attempt to get the tests killed without the runner, for accidental oom. Just didn't think about this in the context of intentionally firing the oom. I'll try whether I can bake up some new subtest in our userptr/mmu-notifier testcases. > [...] > > Wrt the behavior difference: I guess we could put another counter into the > > task struct, and change might_sleep() to check it. All under > > CONFIG_DEBUG_ATOMIC_SLEEP only ofc. That would avoid the preempt-disable > > sideeffect. My worry with that is that people will spot it, and abuse it > > in creative ways that do affect semantics. See horrors like > > drm_can_sleep() (and I'm sure gfx folks are not the only ones who > > seriously lacked taste here). > > > > Up to the experts really how to best paint this shed I think. > > Actually I like a way to say non_block_{begin,end} and might_sleep > firing inside that context. Ok, I'll respin with these (introduced in a separate patch). -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch