Re: [PATCH 3 of 3] thp: mremap support and TLB optimization
From: Andrea Arcangeli <hidden>
Date: 2011-08-23 22:13:47
Hi Andrew, On Tue, Aug 23, 2011 at 02:14:45PM -0700, Andrew Morton wrote:
quoted
+ if ((old_addr & ~HPAGE_PMD_MASK) || + (new_addr & ~HPAGE_PMD_MASK) || + (old_addr + HPAGE_PMD_SIZE) > old_end ||Can (old_addr + HPAGE_PMD_SIZE) wrap past zero?
Good question. old_addr is hpage aligned so to overflow it'd need to be exactly at address 0-HPAGE_PMD_SIZE. Can any userland map an address there? I doubt and surely not x86* or sparc (currently THP is only enabled on x86 anyway so answer is it can't wrap past zero). But probably we should add a wrap check for other archs in the future unless we have a real guarantee from all archs to avoid the check. I only can guarantee about x86*.
- if (!pmd_none(*new_pmd)) {
- WARN_ON(1);
+ if (!WARN_ON(pmd_none(*new_pmd))) {WARN_ON(!pmd_none Thanks for the cleanups! -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>