Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751893AbdGEQJY (ORCPT ); Wed, 5 Jul 2017 12:09:24 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32965 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbdGEQJW (ORCPT ); Wed, 5 Jul 2017 12:09:22 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 05 Jul 2017 13:09:42 -0300 From: victora To: Anshuman Khandual Cc: Victor Aoqui , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, aneesh.kumar@linux.vnet.ibm.com, mpe@ellerman.id.au Subject: Re: [PATCH] powerpc/mm: Implemented default_hugepagesz verification for powerpc In-Reply-To: <4d5950e6-d208-b8d1-ffee-6e54c741c8e0@linux.vnet.ibm.com> References: <20170703200559.3743-1-victora@br.ibm.com> <4d5950e6-d208-b8d1-ffee-6e54c741c8e0@linux.vnet.ibm.com> User-Agent: Roundcube Webmail/1.0.1 X-TM-AS-GCONF: 00 x-cbid: 17070516-0040-0000-0000-000003775FCE X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007324; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00883253; UDB=6.00440609; IPR=6.00663444; BA=6.00005454; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016094; XFM=3.00000015; UTC=2017-07-05 16:09:18 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17070516-0041-0000-0000-0000076B65B5 Message-Id: <2e7aa4b69ac391fdaed7275551a511ff@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-05_10:,, 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-1707050272 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2182 Lines: 57 Em 2017-07-05 01:31, Anshuman Khandual escreveu: > On 07/04/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) > > The function name should be hugetlb_default_size_setup in > sync with the generic function hugetlb_default_setup for the > same parameter default_hugepagesz. > Yes, makes sense to me. >> +{ >> + unsigned long long size; >> + >> + size = memparse(str, &str); >> + >> + if (add_huge_page_size(size) != 0) { > > I am little bit confused here. Do we always follow another > 'hugepages=' element after 'default_hugepagesz' ? If not, > then we dont have to do 'add_huge_page_size'. But then > that function checks for valid huge page sizes and skips > adding hstate if its already added. So I guess it okay. > 'default_hugepagesz=' is not always followed by 'hugepages=', but if we specify 'hugepages=' along with 'default_hugepagesz=' it will try to allocate the hugepage size specified. If the size is not supported by hardware, it will try to allocate the number of pages specified with the default hugepage size of the arch, which is not the desired behavior. So calling add_huge_page_size would verify if the hugepage size is supported and in case it's not, hugepages will not be allocated. >> + hugetlb_bad_size(); >> + pr_err("Invalid default huge page size >> specified(%llu)\n", size); > > Error message should have 'ppc' some where to indicate that > the arch rejected the size not core MM.