Commit 052cc794 authored by Mao Minkai's avatar Mao Minkai Committed by guzitao
Browse files

sw64: add arch_hugetlb_valid_size for C4

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IB73UR



--------------------------------

Add arch_hugetlb_valid_size routine used to validate passed huge page
size.

Remove hugepagesz= command line parsing which has been moved into an
arch independent routine.

Signed-off-by: default avatarMao Minkai <maominkai@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent c6aab75e
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -433,20 +433,14 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
}
#endif /* CONFIG_HUGETLB_PAGE */

static __init int setup_hugepagesz(char *opt)
bool __init arch_hugetlb_valid_size(unsigned long size)
{
	unsigned long ps = memparse(opt, &opt);

	switch (ps) {
	switch (size) {
	case PUD_SIZE:
	case PMD_SIZE * CONT_PMDS:
	case PMD_SIZE:
		hugetlb_add_hstate(ilog2(ps) - PAGE_SHIFT);
		return 1;
		return true;
	}

	pr_err("hugepagesz: Unsupported page size %lu M\n",
			ps >> 20);
	return 0;
	return false;
}
__setup("hugepagesz=", setup_hugepagesz);