Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965326AbdGTQ6s (ORCPT ); Thu, 20 Jul 2017 12:58:48 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58691 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753461AbdGTQ6r (ORCPT ); Thu, 20 Jul 2017 12:58:47 -0400 From: Victor Aoqui To: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, aneesh.kumar@linux.vnet.ibm.com, mpe@ellerman.id.au, khandual@linux.vnet.ibm.com Cc: victora@br.ibm.com, victora@linux.vnet.ibm.com Subject: [PATCH v2] powerpc/mm: Implemented default_hugepagesz verification for powerpc Date: Thu, 20 Jul 2017 13:58:38 -0300 X-Mailer: git-send-email 2.11.0 (Apple Git-81) X-TM-AS-MML: disable x-cbid: 17072016-1523-0000-0000-000002B5C5C2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072016-1524-0000-0000-00002A4F0843 Message-Id: <20170720165838.3549-1-victora@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-20_09:,, 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-1706020000 definitions=main-1707200260 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1176 Lines: 43 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 --- v2: - Renamed default_hugepage_setup_sz function to hugetlb_default_size_setup; - Added powerpc string to error message. 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 e1bf5ca..3a142fe 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -780,6 +780,21 @@ static int __init hugepage_setup_sz(char *str) } __setup("hugepagesz=", hugepage_setup_sz); +static int __init hugetlb_default_size_setup(char *str) +{ + unsigned long long size; + + size = memparse(str, &str); + + if (add_huge_page_size(size) != 0) { + hugetlb_bad_size(); + pr_err("Invalid powerpc default huge page size specified(%llu)\n", size); + } + + return 1; +} +__setup("default_hugepagesz=", hugetlb_default_size_setup); + struct kmem_cache *hugepte_cache; static int __init hugetlbpage_init(void) { -- 1.8.3.1