Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3481039rwb; Fri, 16 Dec 2022 15:59:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf5BGcCZjKdrmxCyeKFfcV8IjTBdmQctPtdfp2bvGzBwdizodbcEkysAVkHexpb/WzTd3p4N X-Received: by 2002:a05:6402:142:b0:46f:f36b:a471 with SMTP id s2-20020a056402014200b0046ff36ba471mr29435579edu.22.1671235167337; Fri, 16 Dec 2022 15:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671235167; cv=none; d=google.com; s=arc-20160816; b=lIOPwE9upyG37sI8H/I08epOpqEQmpEkJ4ebcbqUAoest3VsobeXq+CGqxuRImTsNz EAXAYUAslqGYJB4lfitO0nQ3HuwRZBV0W11uQHOZjqqZIoLIgSZwbnWDMushtI7rw7dL PGuagI+zca1JtvQje+biWnKDj4XvukVgMrpAdJzBACeyyCpheAX9R7Bf7pUc3BSBtOsT AzZSrm+MoCiFcJeP7uchCSBEmK5udvdvaho1BKW9ZA4SMc6ZcWCnJN59d6tjaGjiAHKG WTYifk13wvL2gOs4WvNIzNSYsMD5uH6gopValVmosP1umyldBwT+hjAeVCbSW7BWn8Gc 41CQ== 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=4geIFgohHN4V2E0I6+FGhEQJkz1z5K5O6WzUYsM7e5U=; b=Z3a5VI2lOpEdrVjwPgIQm6l8Nlop+puey6w6Y/rMP0gJLp4xc6tFrLkGY40xYmlgbT /Z5G2jRI2Henw4zBIgwNDaMhhhUmV+4GZzwWsHHGjlgZnUqpt+CAEIRtOk1O34Q1Jxis InsN7kAx484a24YUnKfVNi5B9ctjk5zyQkA1BjPdqEdgJd/vJ6TtzrKRDUoPXvtsiGMn eQrwKXjGZgBFm39GhigYep/ha7VoxN43n0R9C6oDvBHg9E0Nmm+fwk2OVZLy4NnICifd 4Syk4j5FbS3lnXHzY+GCjfLQ4c+BpkKeOmrL3p9x17ywyMmJLZmdpnZVIYW/3mlTPt14 OFTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=cSUY2ZdG; 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 v9-20020aa7d9c9000000b0047531b0169asi3049903eds.301.2022.12.16.15.59.11; Fri, 16 Dec 2022 15:59:27 -0800 (PST) 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=korg header.b=cSUY2ZdG; 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 S229807AbiLPW1k (ORCPT + 68 others); Fri, 16 Dec 2022 17:27:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiLPW1i (ORCPT ); Fri, 16 Dec 2022 17:27:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 358805FB87 for ; Fri, 16 Dec 2022 14:27:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E52AFB81E2C for ; Fri, 16 Dec 2022 22:27:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56420C433EF; Fri, 16 Dec 2022 22:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1671229654; bh=hzy1hiFBPCnzXpEnk22ZSBgCkM7Z7HkItAy2prfBEyg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cSUY2ZdGsqNUcmdlXkHRvtAK8zlaayBPKqovHUcABVrkqfFKSGVDAH/6PCRZxhVL6 9Ph5D1d3kkon0n8hdplZSt4D258K+cGvlwwpnRBJTslTh83gABU+bmYFM6zN2DcKm1 Vx2fab42NE8lGkDgBFyJzZxb4Cw38ay/kl6eZYds= Date: Fri, 16 Dec 2022 14:27:33 -0800 From: Andrew Morton To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com Subject: Re: [PATCH mm-unstable] mm: move folio_set_compound_order() to mm/internal.h Message-Id: <20221216142733.e2a716a4cd7ea55240d98391@linux-foundation.org> In-Reply-To: <20221213212053.106058-1-sidhartha.kumar@oracle.com> References: <20221213212053.106058-1-sidhartha.kumar@oracle.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Tue, 13 Dec 2022 13:20:53 -0800 Sidhartha Kumar wrote: > folio_set_compound_order() is moved to an mm-internal location so external > folio users cannot misuse this function. Change the name of the function > to folio_set_order() and use WARN_ON_ONCE() rather than BUG_ON. Also, > handle the case if a non-large folio is passed and add clarifying comments > to the function. > This differs from the version I previously merged: --- a/mm/internal.h~mm-move-folio_set_compound_order-to-mm-internalh-update +++ a/mm/internal.h @@ -384,8 +384,10 @@ int split_free_page(struct page *free_pa */ static inline void folio_set_order(struct folio *folio, unsigned int order) { - if (WARN_ON_ONCE(!folio_test_large(folio))) + if (!folio_test_large(folio)) { + WARN_ON_ONCE(order); return; + } folio->_folio_order = order; #ifdef CONFIG_64BIT Makes sense. But wouldn't if (WARN_ON_ONCE(order && !folio_test_large(folio))) be clearer?