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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B8DBC19F2A for ; Thu, 11 Aug 2022 20:43:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D9D46B0073; Thu, 11 Aug 2022 16:43:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 288E68E0001; Thu, 11 Aug 2022 16:43:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 151436B0078; Thu, 11 Aug 2022 16:43:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 02DAF6B0073 for ; Thu, 11 Aug 2022 16:43:30 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id ADF5E1218CF for ; Thu, 11 Aug 2022 20:43:29 +0000 (UTC) X-FDA: 79788487338.25.B474ADB Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by imf02.hostedemail.com (Postfix) with ESMTP id 4E9D18018A for ; Thu, 11 Aug 2022 20:43:29 +0000 (UTC) Received: by mail-ej1-f54.google.com with SMTP id a7so35538256ejp.2 for ; Thu, 11 Aug 2022 13:43:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=e1x0MTjrSOgrGHOWzAckTlqNox//QChLMoeIA7WfW2k=; b=UM5HmGuT0UAQsAFcoKMwyI8nZDiKol+BUXRUdnq8zJ4U+h7fJJGG0ljyHZKPGxHQIk QymPhO/p9bi/puHLK5lylYclq9Aedf/pFx6fK9vFtGJUUdpVEoBktF+S4XqGMofgQAbc IguFfv3HIUbZTLU8zWkXKHsX/D2250fzoKz1k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=e1x0MTjrSOgrGHOWzAckTlqNox//QChLMoeIA7WfW2k=; b=pdoCvbgkfg6pxQImoUdCb9m9d8EluQEdpGx7mwp8Vya1LNSrq6j9XGUcuWjyUIkHkq ooWrLQ0u5uRi3gpvKbZ6u0QXIniVqcAYAxA2hLHyYSWbV91AdBM5cn7VMhoffUG0XQBh whSGv6UEAvNYJoucmHFIIppEdWoH5JFZ1dhBv3gFCRESyZ3phpBUDjD8YphrKxh7etwx o7Z7m7ADaUeZes/ah+nDPcWkntPBSejtRQOgrAn19bsTiFrfqE+fYRIlFhr1+EIb95uj XtyXQR5VN4bYTPuPPxbJ/n9f4jdPI8v/4oV6gRVlhlp9kN4cTCvhYMdIUyNy9OZ9uVN+ xfPA== X-Gm-Message-State: ACgBeo0BtVlmxGBazh8jYkmc4JUBrZlzs55A3je1hT7ZTEO3gNHsB1eF Oau5U/Wydh0ayJxTSg/k1jAHOFJXrJ1br+A2 X-Google-Smtp-Source: AA6agR70cB84sCv6/hUDQreoZ/9nSJQxL/CfDHO8bjT6NqSc/LfkaRb3JII/Kh1A3hStDoekqi4SKw== X-Received: by 2002:a17:907:e88:b0:730:8e7d:2281 with SMTP id ho8-20020a1709070e8800b007308e7d2281mr595792ejc.20.1660250607608; Thu, 11 Aug 2022 13:43:27 -0700 (PDT) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com. [209.85.128.52]) by smtp.gmail.com with ESMTPSA id a14-20020aa7cf0e000000b0043acddee068sm237800edy.83.2022.08.11.13.43.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Aug 2022 13:43:26 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id i128-20020a1c3b86000000b003a536d58f73so3268653wma.4 for ; Thu, 11 Aug 2022 13:43:25 -0700 (PDT) X-Received: by 2002:a05:600c:4ed0:b0:3a3:3ef3:c8d1 with SMTP id g16-20020a05600c4ed000b003a33ef3c8d1mr6769254wmq.154.1660250605443; Thu, 11 Aug 2022 13:43:25 -0700 (PDT) MIME-Version: 1.0 References: <20220808073232.8808-1-david@redhat.com> <1a48d71d-41ee-bf39-80d2-0102f4fe9ccb@redhat.com> In-Reply-To: From: Linus Torvalds Date: Thu, 11 Aug 2022 13:43:09 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] sched/all: Change BUG_ON() instances to WARN_ON() To: Ingo Molnar Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, Andrew Morton , Greg Kroah-Hartman , Axel Rasmussen , Peter Xu , Hugh Dickins , Andrea Arcangeli , Matthew Wilcox , Vlastimil Babka , John Hubbard , Jason Gunthorpe , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Mel Gorman Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660250609; a=rsa-sha256; cv=none; b=cAZClSS6+Em588iO3Wcn2KtJKrLMZh5/nGZaBAdhGRL2GSLAEy7gkjJvFEpQvl/CObBFNr /4g37ZnlDt6q8W/oOsGhTt6KelN5gC59JeMlvlOJfsOSoFOedkwABNOT48a6XeJQFSqcGf s1ccTXe312D4iY89jQ8j9mvBbYJgXYc= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=UM5HmGuT; spf=pass (imf02.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.218.54 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660250609; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=e1x0MTjrSOgrGHOWzAckTlqNox//QChLMoeIA7WfW2k=; b=e2D60LHsgO/RHtqmjv5X6Em6RbqJgO/CLt6+VeuTGXwCzqptqNM5p+Y7t3hbEM6z/LV/0A wKirtp1AtySdHEBpz7f3X4kaAYxImeUOsoun90q5gujR1Co03Sd34f/swLUH+5wdmuliN8 X50X3M2aOxAu0YzF1n00GnxI1aCkrQ0= X-Rspamd-Queue-Id: 4E9D18018A Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=UM5HmGuT; spf=pass (imf02.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.218.54 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: xmregg3qccrybd9saqo4n93aq5t5pu8t X-HE-Tag: 1660250609-583551 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, Aug 11, 2022 at 12:13 AM Ingo Molnar wrote: > > By using a WARN_ON() we at least give the user a chance to report > any bugs triggered here - instead of getting silent hangs. > > None of these WARN_ON()s are supposed to trigger, ever - so we ignore > cases where a NULL check is done via a BUG_ON() and we let a NULL > pointer through after a WARN_ON(). May I suggest going one step further, and making these WARN_ON_ONCE() instead. >From personal experience, once some scheduler bug (or task struct corruption) happens, ti often *keeps* happening, and the logs just fill up with more and more data, to the point where you lose sight of the original report (and the machine can even get unusable just from the logging). WARN_ON_ONCE() can help that situation. Now, obviously (a) WARN_ON_ONCE *can* also result in less information, and maybe there are situations where having more - possibly different - cases of the same thing triggering could be useful. (b) WARN_ON_ONCE historically generated a bit bigger code than WARN_ON simply due to the extra "did this already trigger" check. I *think* (b) is no longer true, and it's just a flag these days, but I didn't actually check. so it's not like there aren't potential downsides, but in general I think the sanest and most natural thing is to have BUG_ON() translate to WARN_ON_ONCE(). For the "reboot-on-warn" people, it ends up being the same thing. And for the rest of us, the "give me *one* warning" can end up making the reporting a lot easier. Obviously, with the "this never actually happens", the whole "once or many times" is kind of moot. But if it never happens at all, to the point where it doesn't even add a chance of helping debugging, maybe the whole test should be removed entirely... Linus