Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1115860pxu; Wed, 6 Jan 2021 12:44:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAi6EEG+kuzn6zXPI1fY0u0xyr+sOq1XL2fUtRlyAqtKEFRBxL+317NOgA0jG59JQRAiK/ X-Received: by 2002:aa7:d750:: with SMTP id a16mr5185617eds.252.1609965855252; Wed, 06 Jan 2021 12:44:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609965855; cv=none; d=google.com; s=arc-20160816; b=xjTCqv2jrdALa3qYxqEjfDFlJvjhW6uQatdYqr2ZMJ0VXpO7ORkqTILji6vXnP16Mv FWUAzMatCa96E7j3tQDZhnVcJS8z/vOaSj8rmFg3/K/qSzF3wB5sqRIF2nueSvFAw9bj 7H6r3aCE96oOFzoaL2f2Y+mjyxLz4gpTKkrukjmGnzp+LCIYM9sYCSnkChBtV5Zbj3Q2 0HYNMeQXqWGBtpWWUuM1mjMJpMemEQZBXwRJkVXiH10hzC5nD0/vugdLjdZK0y+9v5EW lJ8EVDtb3PAM7OW9HPl3iOhOf7Y0RuE7tZo/aSzqPXqgamzNqX4aVgXoC83O5YGcqrTO 8UmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=oR+x/f/VXWfFeLAC74WWTOJAc33nNPDkZBExF4TKX5k=; b=GNc80PFHYswmpjL1aLG9inp0OB5E9MVRdCHEZGZsfZXbYPwGYkaGl+Iw+wBD650SG5 Gic6md/UcZ80aOakjq8Q04rde2nTUigOw9VLN9gQtBaude5I0w0lQ4bqSzaG5c0ZrdK5 dJfmkfk/NruDZ+cY/d5A1w8WF4CLAjRRKhW+vLcds81NH4V8t6Kcb8P4uXEiLskI7WuU 33JDj5DxFwW5Cm5K31XecGthE2vBGrI73Ao7KqoydLKdGhHUNkIJJs9jqhVaDX/sNeOZ 9vBNw4cLdFphJO/FtvQmhRDemYXn/VwCzBDdhhCXqIkmEifZVsMQ7bhIw/FHANnPP0L1 c5Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="KV/Ds+kD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gw26si1305965ejb.537.2021.01.06.12.43.51; Wed, 06 Jan 2021 12:44:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="KV/Ds+kD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727833AbhAFUnH (ORCPT + 99 others); Wed, 6 Jan 2021 15:43:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:55894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727475AbhAFUnE (ORCPT ); Wed, 6 Jan 2021 15:43:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B71A62311B; Wed, 6 Jan 2021 20:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1609965744; bh=B+PNb+h2TeheRTPPGBzTfoOQ6M+qd4Q24FS81ZUfhlI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KV/Ds+kDNkjHOEmMFYGyLDU52yYBs5Yt7qulmBQChv/DsKJiOzNZqULO+dOgLL4Gp 9AoDKCTZ8oaf0ZBZBVlYT9e2jSeghaJxiU5WVA71n+/ATEWZ/VKScY59UDSlYSL8JU mg50ew8+7+NrXBFW0dPQqwf4Y9sR/j6jnA7OZGJ4= Date: Wed, 6 Jan 2021 12:42:23 -0800 From: Andrew Morton To: Hugh Dickins Cc: Andrea Arcangeli , Alex Shi , Minchan Kim , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/mmap: replace if (cond) BUG() with BUG_ON() Message-Id: <20210106124223.587b93e5fdfd6a1a5f799c16@linux-foundation.org> In-Reply-To: References: <1607743586-80303-1-git-send-email-alex.shi@linux.alibaba.com> <1607743586-80303-2-git-send-email-alex.shi@linux.alibaba.com> <20210106114620.5c221690f3a9cad7afcc3077@linux-foundation.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 6 Jan 2021 12:18:36 -0800 (PST) Hugh Dickins wrote: > On Wed, 6 Jan 2021, Andrea Arcangeli wrote: > > > > I'd be surprised if the kernel can boot with BUG_ON() defined as "do > > {}while(0)" so I guess it doesn't make any difference. > > I had been afraid of that too, when CONFIG_BUG is not set: > but I think it's actually "if (cond) do {} while (0)". Yes, that is so. The thinking being that in most cases the compiler will be smart enough to avoid generating any code for `cond' anyway.