Commit 3d116b4f authored by Lei Yilong's avatar Lei Yilong Committed by guzitao
Browse files

sw64: kvm: fix an error when unmapping 512M hugepages

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



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

In sw64 architecture, 512M hugepage consist of 64 consecutive 8M
hugepages. Therefore, at the time of unmapping, we should get the
address of the next 512M hugepage. Current code get the address of
the next 8M hugepage, it will be out of range when we unmap the page,
so we fix it.

Signed-off-by: default avatarLei Yilong <leiyilong@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent bb54d23e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -146,8 +146,10 @@ static void unmap_apt_pmds(struct kvm *kvm, pud_t *pud,
		if (!pmd_none(*pmd)) {
			if (pmd_trans_huge(*pmd)) {
				if (pmd_cont(*pmd)) {
					for (i = 0; i < CONT_PMDS; i++, pmd++)
						pmd_clear(pmd);
					for (i = 0; i < CONT_PMDS; i++)
						pmd_clear(pmd + i);
					pmd += CONT_PMDS - 1;
					next += CONT_PMD_SIZE - PMD_SIZE;
				} else
					pmd_clear(pmd);
				/* Do we need flush tlb???? edited by lff */