From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A65BDC433E0 for ; Thu, 11 Mar 2021 09:32:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0AB8D64FB5 for ; Thu, 11 Mar 2021 09:32:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AB8D64FB5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2C6A78D02A2; Thu, 11 Mar 2021 04:32:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 275FE8D028E; Thu, 11 Mar 2021 04:32:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 117C78D02A2; Thu, 11 Mar 2021 04:32:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id EA2DF8D028E for ; Thu, 11 Mar 2021 04:32:33 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A3626180ACEF0 for ; Thu, 11 Mar 2021 09:32:33 +0000 (UTC) X-FDA: 77907078186.05.698E703 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf01.hostedemail.com (Postfix) with ESMTP id 288122000383 for ; Thu, 11 Mar 2021 09:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9I8ygaaFUwUSiRg1sGOHfSuV4vrE4sCR9d4qE3JUt9Q=; b=NoTljWZI3JTNqBz09M904YeWwh nOf5h2+ddkImXms7dWtlDbA6oyfUqzHOQilfR4zMn4roVJDYBConJDogzde4dqqSjFeLmtQYOg1Zr ik+aBbpTyC+qld+wDVNkPD834hXBFwAZqTZu4o4aEfmS9XUJtZc7yKHPGy1IJYzgPanqhZMu5YVe7 PTHoHvA3Hp5Cil8lyrKVLcSpYSc2B5MqoIZySmWi4sM+BIzQBm76/21zbu0B7Fk3dMDTc1moHKn5I 7YE5oPeh8huT5Jn1RsDb8IEk7x1sK0obejn/B/u64XrKw7+f4igQ2OtX7vdlIem3ZjMjkaGOA+wPH rOYw3ifA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lKHg9-008lJj-IL; Thu, 11 Mar 2021 09:32:25 +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 CB4B03013E5; Thu, 11 Mar 2021 10:32:24 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ABF6E299E3D28; Thu, 11 Mar 2021 10:32:24 +0100 (CET) Date: Thu, 11 Mar 2021 10:32:24 +0100 From: Peter Zijlstra To: Michal Hocko Cc: Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Paul E . McKenney" , Shakeel Butt , tglx@linutronix.de, john.ogness@linutronix.de, urezki@gmail.com, ast@fb.com, Eric Dumazet , Mina Almasry , Andrew Morton Subject: Re: [PATCH] hugetlb: select PREEMPT_COUNT if HUGETLB_PAGE for in_atomic use Message-ID: References: <20210311021321.127500-1-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: zcpmx3exc5n3ubya1pw6zoih88g9jqcp X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 288122000383 Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=desiato.infradead.org; client-ip=90.155.92.199 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615455153-473217 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Mar 11, 2021 at 10:01:22AM +0100, Michal Hocko wrote: > On Thu 11-03-21 09:46:30, Peter Zijlstra wrote: > > On Wed, Mar 10, 2021 at 06:13:21PM -0800, Mike Kravetz wrote: > > > from irq context. Changing the check in the code from !in_task to > > > in_atomic would handle the situations when called with irqs disabled. > > > > It does not. local_irq_disable() does not change preempt_count(). > > You are right. Earlier I was suggesting to check of irq_disabled() as > well http://lkml.kernel.org/r/YD4I+VPr3UNt063H@dhcp22.suse.cz > > back then it was not really clear to me that in fact we do care about > spin locks more than irq disabled code. I am not even sure whether we > need to care about irq disabled regions without any locks held that > wouldn't be covered by in_atomic. But it would be safer to add > irq_disabled check as well. Safer still is always doing it, replace it with if (true). What's the purpose, doing the minimal 'correct', of the maximal safe solution? The whole changelog reads like a trainwreck, but akpm already commented on that. I picked out a small factual incorrectness, simply because if you can't get that right, the whole argument looses weight. That said, I don't think you actually need it, if as you write the lock should be IRQ-safe, then you're worried about the IRQ recursion deadlock: spin_lock(&A); spin_lock(&A); And that obviously cannot happen when IRQs are disabled, even if you were holding a lock. Anyway, I think I support Andrew here, this needs proper fixing, not bandaids.