Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2282776imm; Thu, 11 Oct 2018 07:57:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV60QQpd5KhxQ22sbHKvzxpRJmaGY7C1ciMkU9A2npzH/UBM2qv5ZsvSAM8gKI8FDgisSmt8P X-Received: by 2002:a63:8c4:: with SMTP id 187-v6mr1750777pgi.396.1539269839942; Thu, 11 Oct 2018 07:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539269839; cv=none; d=google.com; s=arc-20160816; b=qLngBsD1/kDfpqVEZYBu0mXIiu8sebsoig7Ns1iZM5I+ZRf8UOhYsY5FnqYI+loN83 ieBfOngsbZyB3URrvXtI+XtFrYjDEpv6pqTyPlbLhEyhI9ec262TYTiU+yxlqTZKX35V yloAhvyChb87ie1gJJRj5TNMv9tUGmEz1Q/e0DeW7pGDcq4kxT38VNdQd6GbIguU3CoX xnVGSomXlIjyFNoLHE/VOhpGZLiZEx4+JoYtZSvLDIdBdWx05rRp1Lq92KqGbZy44y+X FEaSqHl/xs9PJVW5l/JxdGHTPYBlzEAd3sPauc6EExTcEFYSHiOyNhDwXLm4HPuiILwN avDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=AoSZdbLmK6XOITYCkDCAesKK1Gz0oj0WQaTmAgOJAqM=; b=nyz8z+XjLdMr/5Vz6zzDDAElDz/NirTQXBaobjYvPCSGj+3EC8lD0XbVda5LQc/y3X mwCUnntV/YZDReUvPZfizal+JTxzbvhRYDkXjQZF1LeIAct6EWnZGfmdMq7EO4uu5pFJ +b+V+sDU539Yz4N2rfe5dZpBtRKBETIk/G7vzb41v/lGWsHbCmf1hx00pzHwNBgH85L9 Gwu8bIFHn0bd9RoTHJNITwurZeOEOlHrPbMHftt9iLvUId0Q6waSUJ/GZbkENvoYDbnX Kz+lRp/FyxAHEEVOigvOr78FhDqWsoC2kkuDuf81h5J6ddL6WXBKzMI24olL6zEzINBc BABw== 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 202-v6si25855997pgb.63.2018.10.11.07.57.02; Thu, 11 Oct 2018 07:57:19 -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 S1727988AbeJKVEq (ORCPT + 99 others); Thu, 11 Oct 2018 17:04:46 -0400 Received: from verein.lst.de ([213.95.11.211]:42926 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbeJKVEq (ORCPT ); Thu, 11 Oct 2018 17:04:46 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id CB5BA68BFE; Thu, 11 Oct 2018 15:37:30 +0200 (CEST) Date: Thu, 11 Oct 2018 15:37:30 +0200 From: Christoph Hellwig To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org, Stephen Bates , Palmer Dabbelt , Albert Ou , Christoph Hellwig , Andrew Waterman , Olof Johansson , Michael Clark , Rob Herring , Zong Li Subject: Re: [PATCH 5/5] RISC-V: Implement sparsemem Message-ID: <20181011133730.GB7276@lst.de> References: <20181005161642.2462-1-logang@deltatee.com> <20181005161642.2462-6-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181005161642.2462-6-logang@deltatee.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +/* > + * 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) > +#define VMEMMAP_SIZE (UL(1) << (CONFIG_VA_BITS - PAGE_SHIFT - 1 + \ > + STRUCT_PAGE_MAX_SHIFT)) Might be more readable with a another define, and without abuse of the horrible UL macro: #define VMEMMAP_SHIFT \ (CONFIG_VA_BITS - PAGE_SHIFT - 1 + STRUCT_PAGE_MAX_SHIFT) #define VMEMMAP_SIZE (1UL << VMEMMAP_SHIFT) > +#define VMEMMAP_END (VMALLOC_START - 1) > +#define VMEMMAP_START (VMALLOC_START - VMEMMAP_SIZE) > + > +#define vmemmap ((struct page *)VMEMMAP_START) This could also use some comments.. > @@ -0,0 +1,11 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > + > +#ifndef __ASM_SPARSEMEM_H > +#define __ASM_SPARSEMEM_H > + > +#ifdef CONFIG_SPARSEMEM > +#define MAX_PHYSMEM_BITS CONFIG_PA_BITS > +#define SECTION_SIZE_BITS 30 > +#endif > + > +#endif For potentially wide-spanning ifdefs like inclusion headers it always is nice to have a comment with the symbol on the endif line.