Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1025352rwb; Thu, 11 Aug 2022 14:25:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR6nlfKd6KTSjCLtpYL4VgN1b0+/AOiWdfOnxAUT9ek0gyKOHpkExpP9xeIzbGPrPIym2AfD X-Received: by 2002:a05:6a00:2391:b0:52d:ebc4:75d7 with SMTP id f17-20020a056a00239100b0052debc475d7mr700107pfc.84.1660253158795; Thu, 11 Aug 2022 14:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660253158; cv=none; d=google.com; s=arc-20160816; b=dVK2cj7QrSiEeNHsTQA4WAStbQw13XxR/4rFsZnN7/TczmANDlG3AjKfpSJzToF389 WxL/DHxjr8sw1Q/kE2ym9BF+BVrcWiTfkIlbmI64mW+3T11Y8/rhH70l2GbzIVOJDaas VdbKiA0HdYK4899OJHLjLgKhANWUMosRqQieJ+G0KeCZngclWsq9D3rQYHZmH52iTQ4c RZxjy3OJkBwKIA8AXoPjiqBdU+l4Foao7hseA9fxdwLgLrrl9MRMlSEda0xP+odFHnTy n3VOe0sAInfnkdfYa3igqRp1sgnce5BzYGLNCUvUlZiG260i26V83iEnP8VjJ+3p3pIt kPAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=e1x0MTjrSOgrGHOWzAckTlqNox//QChLMoeIA7WfW2k=; b=Y7DHeLwRH4YZs9eBbCB6b9qEzN/vqjPJytBrbUgs9AiowDlE82xoYtrJ7Fp00UGP8o IGJtTJ1KADSSlkTf+dtQd1nfXqdjURvuxGs1CFKDHqYqeY6niPefvQss9EfvlajbuR0i pTMoLGmkE4voLRYWm5ypGrMVD6lagCllQwwbl3tM/FK15zpEncPMfKaFs3rK+GeZiKcH TXn9ZXCf1Iir6aJSygsqBC/wvp7m9bcgI3aQFIfyXa3IueJEALPWg71G1Djzmua5IVFe iDENHUBfrBLWWzQmJwRYX0C4juEztsDne39sjEAPahPiuUH/XH6ivOkVBnlhF5YKksLN 49TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=UM5HmGuT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a63114d000000b004129a78936fsi441483pgr.1.2022.08.11.14.25.45; Thu, 11 Aug 2022 14:25:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=UM5HmGuT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234484AbiHKUnc (ORCPT + 99 others); Thu, 11 Aug 2022 16:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbiHKUn3 (ORCPT ); Thu, 11 Aug 2022 16:43:29 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B19678BE0 for ; Thu, 11 Aug 2022 13:43:28 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id o22so24381698edc.10 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=IlVOE27lr/d0izN3PhTmrYaw54EeZYAUFrfqIzx/rQOY7WE+1nRlPrbIeiiuWGbU60 0IhFZrwjsx5lUFLJ4HvYHcgS0vzZZZxuFfp361EHQzlwWqCJyhbvKO0W6hUxlffyAL0o +/0EYlrWViEIK/qPUfwoU0OzjMJIQXcBzO407kG/S+p0rOYFquzJCtZ7l+VN1CKUAvYc a7BSV7F9Gr1kAYMdSuPXSA5RnR7MRXrn7mx6LMGrtPBTxv84J1YER15B4JJwc0KM3+rC pVhw2/xJLwYhKZwoEZ/J4qGN4VWOzgGvN0viyteMC6k5RxW9wE7ZkC/7DA+XLIEE17RF jYEw== X-Gm-Message-State: ACgBeo2CmJuIeC2xKy2Q58TpNPdOvBHT2z1EtoI6ypsOB/n20qQDUaE9 k5p0gXoAuSxSkJSPxOta2098+ELTgBNr/FGm X-Received: by 2002:aa7:d795:0:b0:43c:eb00:fc77 with SMTP id s21-20020aa7d795000000b0043ceb00fc77mr769327edq.284.1660250606869; Thu, 11 Aug 2022 13:43:26 -0700 (PDT) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com. [209.85.128.43]) by smtp.gmail.com with ESMTPSA id o6-20020aa7c506000000b0043e8334f762sm244467edq.65.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-f43.google.com with SMTP id b21-20020a05600c4e1500b003a32bc8612fso3208557wmq.3 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" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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