Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751110AbdGEE0p (ORCPT ); Wed, 5 Jul 2017 00:26:45 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56233 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750720AbdGEE0o (ORCPT ); Wed, 5 Jul 2017 00:26:44 -0400 Subject: Re: [PATCH] powerpc/mm: Implemented default_hugepagesz verification for powerpc To: Victor Aoqui , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au Cc: victora@linux.vnet.ibm.com References: <20170703200559.3743-1-victora@br.ibm.com> From: "Aneesh Kumar K.V" Date: Wed, 5 Jul 2017 09:56:30 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170703200559.3743-1-victora@br.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17070504-0012-0000-0000-0000149912E6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007321; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00883019; UDB=6.00440468; IPR=6.00663210; BA=6.00005453; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016087; XFM=3.00000015; UTC=2017-07-05 04:26:41 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17070504-0013-0000-0000-00004E72448D Message-Id: <1f549637-773a-868c-effd-5614e85aa892@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-05_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1707050072 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1646 Lines: 57 On Tuesday 04 July 2017 01:35 AM, Victor Aoqui wrote: > Implemented default hugepage size verification (default_hugepagesz=) > in order to allow allocation of defined number of pages (hugepages=) > only for supported hugepage sizes. > > Signed-off-by: Victor Aoqui > --- > arch/powerpc/mm/hugetlbpage.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c > index a4f33de..464e72e 100644 > --- a/arch/powerpc/mm/hugetlbpage.c > +++ b/arch/powerpc/mm/hugetlbpage.c > @@ -797,6 +797,21 @@ static int __init hugepage_setup_sz(char *str) > } > __setup("hugepagesz=", hugepage_setup_sz); > > +static int __init default_hugepage_setup_sz(char *str) > +{ > + unsigned long long size; > + > + size = memparse(str, &str); > + > + if (add_huge_page_size(size) != 0) { > + hugetlb_bad_size(); > + pr_err("Invalid default huge page size specified(%llu)\n", size); > + } > + > + return 1; > +} > +__setup("default_hugepagesz=", default_hugepage_setup_sz); isn't that a behavior change in what we have now ? . Right now if size specified is not supported, we fallback to HPAGE_SIZE. mm/hugetlb.c if (!size_to_hstate(default_hstate_size)) { default_hstate_size = HPAGE_SIZE; if (!size_to_hstate(default_hstate_size)) hugetlb_add_hstate(HUGETLB_PAGE_ORDER); } > + > struct kmem_cache *hugepte_cache; > static int __init hugetlbpage_init(void) > { > Even if we want to do this, this should be done in generic code and should not be powerpc specific -aneesh