Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1732396rwb; Thu, 8 Dec 2022 14:41:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5yF5dxbBssRy4LY7xxbIJ1Ir/HIQv4132sxvijhPSdk2GVXSqYl75YK1ckgxvx/j6EJc1k X-Received: by 2002:a05:6402:1458:b0:46b:7706:652a with SMTP id d24-20020a056402145800b0046b7706652amr3170282edx.27.1670539311177; Thu, 08 Dec 2022 14:41:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670539311; cv=none; d=google.com; s=arc-20160816; b=WFXiqSlvcopoBTPh4gD8wRBHrM2+3/aAT6e85LaKRlQqwi3GlFZoIfl3rbJJrcxZtn 6WgEmbeCoi6wSUeCwbT03IKXa60dpRsjA70rEaGRwxZyPrzpbyQ3aVeCQ71jeMikScZW H3r8sKVH7hUA7EnPKI3ekpJCZdWSL9TEXWNCKIT6UVFtM1YP58KI4MI/RMOavU0TRAXe R6mVGlgcA9aDMnS+hFfnaN7BMawubaKyTwdqkfEQ9zZmjNao1+wL4BKpK1VW5bUCSXwe rJz292+2Xbch2NluSvntjj6oxrfYopKU1IUFw1l6YopCJ+fP5nQq5vrAjBmK//LUxusx yVZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XHcJ8SFuAjHDaK1/sDcU1aP6FVHrSJrqK2PQkn+GzIA=; b=NuA/wpQFVAT5HnC2c+SM1kyN5ySPX4+wGKmFq0+I2AvqEiFjCBEtx5vj4flESrYp0n ISE+WDSLxiRKBdqPbkzxeG5g4Dq94ayD+BlvFAh7r6litHiHiSHSTcTkj93/BjPhFYtF b7+OVgaJaIj7EZCtNN538P5zvBIlOLi2Iv/GH8fNrc7Ei5ZwkqyQOVMBeavhsyRK0DHC 2v9zDWo6Lx7hl5g3mAADSwtw2xmPvhEAKYl9MmqSPxEQbnmMQIa5/0EniBSSWSHjFyvd z+HPLNT9Ofhdv2JsGQpf7obyeiB5X9qbnQ9iiq1ALdMS7uwi1pG2DS/pGNKIkPfEBb0j ElZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MaowyLHm; 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 u1-20020a1709064ac100b007adb868f102si15222913ejt.476.2022.12.08.14.41.32; Thu, 08 Dec 2022 14:41:51 -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=@infradead.org header.s=casper.20170209 header.b=MaowyLHm; 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 S230219AbiLHWGG (ORCPT + 73 others); Thu, 8 Dec 2022 17:06:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229867AbiLHWFd (ORCPT ); Thu, 8 Dec 2022 17:05:33 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE7BC80A26 for ; Thu, 8 Dec 2022 14:04:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=XHcJ8SFuAjHDaK1/sDcU1aP6FVHrSJrqK2PQkn+GzIA=; b=MaowyLHmWPQgkqBIN5HOcX+TId fnlYME6a45ZhMgxqrMWAn0NBXQL3Svo8/I8Oyd39Dy6Pq2xJiesE6aQVKwCM/PayQOO1foS2o33Yn nai5Vm3LF4vGAje6Zo5qVDNe+RDgZSeyAahV8zfKMw5TiR57my0xt7CfgATEi/zY+8jC3nn0v+uFZ d/EU4aCIfYafA3lMQxYu4iFvI9LPThGMV2Yz4i0gIJwHRtwJJxFpOKkglfHQnzMm6fOGNuPqdolt2 p8sKfGq4dQXO4xDTiOenReWBMPnD8n4jE5uCTgaV9hzcVtxT2rPloeYBBf/VSyvzFVxh+kPHP5ooZ bOzc+IVA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3P0S-007NAH-4g; Thu, 08 Dec 2022 22:04:40 +0000 Date: Thu, 8 Dec 2022 22:04:40 +0000 From: Matthew Wilcox To: Sidhartha Kumar Cc: Mike Kravetz , John Hubbard , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, songmuchun@bytedance.com, tsahu@linux.ibm.com, david@redhat.com Subject: Re: [PATCH mm-unstable] mm: clarify folio_set_compound_order() zero support Message-ID: References: <20221207223731.32784-1-sidhartha.kumar@oracle.com> <92965844-c430-8b8e-d9f1-705d7578bceb@nvidia.com> <0187f9c2-e80a-9cde-68bc-c9bdbd96b6fe@oracle.com> <2723541a-79aa-c6b5-d82c-53db76b78145@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2723541a-79aa-c6b5-d82c-53db76b78145@oracle.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 Thu, Dec 08, 2022 at 01:58:20PM -0800, Sidhartha Kumar wrote: > 5) improve the style of folio_set_order() by removing ifdefs from inside the > function to doing > > #ifdef CONFIG_64BIT > static inline void folio_set_order(struct folio *folio, > unsigned int order) > { > VM_BUG_ON_FOLIO(!folio_test_large(folio), folio); > > folio->_folio_order = order; > folio->_folio_nr_pages = order ? 1U << order : 0; > } > #else > static inline void folio_set_order(struct folio *folio, > unsigned int order) > { > VM_BUG_ON_FOLIO(!folio_test_large(folio), folio); > > folio->_folio_order = order; > } > #endif While we usually prefer to put ifdefs outside the function, I don't think that's justified in this case. I'd rather see a comment inside the function like: static inline void folio_set_order(struct folio *folio, unsigned int order) { VM_BUG_ON_FOLIO(!folio_test_large(folio), folio); folio->_folio_order = order; #ifdef CONFIG_64BIT /* * When hugetlb dissolves a folio, we need to clear the tail * page, rather than setting nr_pages to 1. */ folio->_folio_nr_pages = order ? 1U << order : 0; #endif }