Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752693AbdDMMqi (ORCPT ); Thu, 13 Apr 2017 08:46:38 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:59856 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751193AbdDMMqf (ORCPT ); Thu, 13 Apr 2017 08:46:35 -0400 Date: Thu, 13 Apr 2017 05:46:33 -0700 From: Matthew Wilcox To: "Aneesh Kumar K.V" Cc: akpm@linux-foundation.org, mhocko@suse.com, ak@linux.intel.com, mtk.manpages@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Davidlohr Bueso , khandual@linux.vnet.ibm.com Subject: Re: [PATCH] mm,hugetlb: compute page_size_log properly Message-ID: <20170413124633.GG784@bombadil.infradead.org> References: <1488992761-9464-1-git-send-email-dave@stgolabs.net> <20170328165343.GB27446@linux-80c1.suse> <20170328165513.GC27446@linux-80c1.suse> <20170328175408.GD7838@bombadil.infradead.org> <87wpaoq1zy.fsf@skywalker.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wpaoq1zy.fsf@skywalker.in.ibm.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 992 Lines: 22 On Thu, Apr 13, 2017 at 11:32:09AM +0530, Aneesh Kumar K.V wrote: > > +#define SHM_HUGE_SHIFT 26 > > +#define SHM_HUGE_MASK 0x3f > > +#define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT) > > +#define SHM_HUGE_8MB (23 << SHM_HUGE_SHIFT) > > +#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT) > > +#define SHM_HUGE_16GB (34 << SHM_HUGE_SHIFT) > > This should be in arch/uapi like MAP_HUGE_2M ? That will let arch add > #defines based on the hugepae size supported by them. Well, what do we want to happen if source code contains SHM_HUGE_2MB? Do we want it to fail to compile on ppc, or do we want it to request 2MB pages and get ... hmm, looks like it fails at runtime (size_to_hstate ends up returning NULL). So, yeah, looks like a compile-time failure would be better. But speaking of MAP_HUGE_, the only definitions so far are in arch/x86. Are you going to add the ppc versions? Also, which header file? I'm reluctant to add a new header, but asm/shmbuf.h doesn't seem like a great place to put it.