Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2599121imm; Thu, 11 Oct 2018 12:56:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV61VZuqCIvVpPmTcHGWscYdPYDsCi2NEec4k0+mT0oFNACX9PdtElmBw8AUSblJjW+6ByxAh X-Received: by 2002:a62:85cb:: with SMTP id m72-v6mr2888093pfk.173.1539287794743; Thu, 11 Oct 2018 12:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539287794; cv=none; d=google.com; s=arc-20160816; b=tBcbX5aXSCNTvPORKToCHoJj0OqCZDZl4FZ9xdWG5epUPRIaJkC+z6T/npU41Yka1r RcUOWOEF+Ky6/IoFbVc7Ue7jOYqB/NrNikP/QLfOqWqQ9LMD2Rwvo8j2bv7bz2ZFwVNK hLfPa6EpwwKaud8fgfp39oHjPM9bgBeqzq9bq+P/bNjhuJylV1lmSGHDttgLdZ+vgvne NON5yIT99gmhFGMSBl/kOjkBDZ57rAtw7r7FGJHXbBCR+47eLOXw50bNY74gF8xb5J3U ZVcRRhpGXlyOs/AjIqGNKSEcY2vQgcqlJb1CjHBG4/ygc2H8rPJxThMXvdDNXMi6Ju0O XSOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from; bh=h5ySn98nOlapajCQIgDAZxEArxiLmo2SRAnsx/nNEUQ=; b=twFqGgmgxyyPcd/hbPkciWK1SuF5WEHO0S8Eu3ScoswNY+Y64KYpZkHrZBEaZnrVFx ChymvDf9ds8f+VaxLUSwZMBTlnZv+6f1xLrYyqpruPf4A8Np8WQr2+N7gbCb1hNrlgv9 5lbCA/vACEcunea23hKxIx3Pl705eAmh4pY2B5BlDkOfjPWrsjIqUHg66zrG0HSGtW4N 8y3z+raxv6p9Zei9GMuA4ysIU6hwQfNHp3NrmcUcVlelRFznd8GsPXKUpsAnlpOFeCC+ 2sutfL1Lgy9B/UypZy8uoDP058r9rRttk296w2SJpKmpIsO0JKT/lFizOiJPiUMZW4RB PKhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cc4-v6si33681120plb.201.2018.10.11.12.56.06; Thu, 11 Oct 2018 12:56:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727577AbeJLA6k (ORCPT + 99 others); Thu, 11 Oct 2018 20:58:40 -0400 Received: from ale.deltatee.com ([207.54.116.67]:59606 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726126AbeJLA6j (ORCPT ); Thu, 11 Oct 2018 20:58:39 -0400 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1gAemt-0002Cu-3o; Thu, 11 Oct 2018 11:30:16 -0600 From: Logan Gunthorpe To: Christoph Hellwig Cc: Rob Herring , Albert Ou , Andrew Waterman , linux-sh@vger.kernel.org, Palmer Dabbelt , linux-kernel@vger.kernel.org, Stephen Bates , Zong Li , linux-mm@kvack.org, Olof Johansson , linux-riscv@lists.infradead.org, Michael Clark , linux-arm-kernel@lists.infradead.org References: <20181005161642.2462-1-logang@deltatee.com> <20181005161642.2462-6-logang@deltatee.com> <20181011133730.GB7276@lst.de> <8cea5ffa-5fbf-8ea2-b673-20e2d09a910d@deltatee.com> Message-ID: <8ebf1a13-ec4e-c546-641c-f8dcb1f6c44d@deltatee.com> Date: Thu, 11 Oct 2018 11:30:07 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <8cea5ffa-5fbf-8ea2-b673-20e2d09a910d@deltatee.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, michaeljclark@mac.com, linux-riscv@lists.infradead.org, olof@lixom.net, linux-mm@kvack.org, zong@andestech.com, sbates@raithlin.com, linux-kernel@vger.kernel.org, palmer@sifive.com, linux-sh@vger.kernel.org, andrew@sifive.com, aou@eecs.berkeley.edu, robh@kernel.org, hch@lst.de X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH 5/5] RISC-V: Implement sparsemem X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-10-11 10:24 a.m., Logan Gunthorpe wrote: > On 2018-10-11 7:37 a.m., Christoph Hellwig wrote: >>> +/* >>> + * Log2 of the upper bound of the size of a struct page. Used for sizing >>> + * the vmemmap region only, does not affect actual memory footprint. >>> + * We don't use sizeof(struct page) directly since taking its size here >>> + * requires its definition to be available at this point in the inclusion >>> + * chain, and it may not be a power of 2 in the first place. >>> + */ >>> +#define STRUCT_PAGE_MAX_SHIFT 6 >> >> I know this is copied from arm64, but wouldn't this be a good time >> to move this next to the struct page defintion? >> >> Also this: >> >> arch/arm64/mm/init.c: BUILD_BUG_ON(sizeof(struct page) > (1 << STRUCT_PAGE_MAX_SHIFT)); >> >> should move to comment code (or would have to be duplicated for riscv) > > Makes sense. Where is a good place for the BUILD_BUG_ON in common code? Never mind. Seems like it's pretty trivial to do this: #define STRUCT_PAGE_MAX_SHIFT \ ilog2(roundup_pow_of_two(sizeof(struct page))) So the BUILD_BUG_ON becomes unnecessary. The comment saying it can't be done is really misleading as it wasn't actually difficult. Logan