Skip to contentSkip to conversation

kill mm_struct.used_hugetlb

PATCH In review Oleg Nesterov 2 participants 2 messages Jun 26, 2004 – Jun 28, 2004

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kill mm_struct.used_hugetlb

Hello.

mm_struct.used_hugetlb used to eliminate costly find_vma() from follow_page(). Now it is used only in ia64 version of follow_huge_addr(). I know nothing about ia64, but this REGION_NUMBER() looks simple enough to kill used_hugetlb.

There is debug version (commented out) of follow_huge_addr() in i386 which looks at used_hugetlb, but it can work without this check.

Am i missed somethimg?

Oleg.

Signed-off: Oleg Nesterov

arch/i386/mm/hugetlbpage.c +0 -3
diff -urp 6.7-clean/arch/i386/mm/hugetlbpage.c 6.7-hugetlb/arch/i386/mm/hugetlbpage.c
@@ -147,9 +147,6 @@ follow_huge_addr(struct mm_struct *mm, u
 	struct page *page;
 	struct vm_area_struct *vma;
 
-	if (! mm->used_hugetlb)
-		return ERR_PTR(-EINVAL);
-
 	vma = find_vma(mm, addr);
 	if (!vma || !is_vm_hugetlb_page(vma))
 		return ERR_PTR(-EINVAL);
arch/ia64/mm/hugetlbpage.c +0 -2
diff -urp 6.7-clean/arch/ia64/mm/hugetlbpage.c 6.7-hugetlb/arch/ia64/mm/hugetlbpage.c
@@ -158,8 +158,6 @@ struct page *follow_huge_addr(struct mm_
 	struct page *page;
 	pte_t *ptep;
 
-	if (! mm->used_hugetlb)
-		return ERR_PTR(-EINVAL);
 	if (REGION_NUMBER(addr) != REGION_HPAGE)
 		return ERR_PTR(-EINVAL);
 
include/linux/hugetlb.h +0 -8
diff -urp 6.7-clean/include/linux/hugetlb.h 6.7-hugetlb/include/linux/hugetlb.h
@@ -34,13 +34,6 @@ extern unsigned long max_huge_pages;
 extern const unsigned long hugetlb_zero, hugetlb_infinity;
 extern int sysctl_hugetlb_shm_group;
 
-static inline void
-mark_mm_hugetlb(struct mm_struct *mm, struct vm_area_struct *vma)
-{
-	if (is_vm_hugetlb_page(vma))
-		mm->used_hugetlb = 1;
-}
-
 #ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
 #define is_hugepage_only_range(addr, len)	0
 #define hugetlb_free_pgtables(tlb, prev, start, end) do { } while (0)
@@ -72,7 +65,6 @@ static inline unsigned long hugetlb_tota
 #define unmap_hugepage_range(vma, start, end)	BUG()
 #define is_hugepage_mem_enough(size)		0
 #define hugetlb_report_meminfo(buf)		0
-#define mark_mm_hugetlb(mm, vma)		do { } while (0)
 #define follow_huge_pmd(mm, addr, pmd, write)	0
 #define is_aligned_hugepage_range(addr, len)	0
 #define prepare_hugepage_range(addr, len)	(-EINVAL)
include/linux/sched.h +0 -3
diff -urp 6.7-clean/include/linux/sched.h 6.7-hugetlb/include/linux/sched.h
@@ -217,9 +217,6 @@ struct mm_struct {
 	unsigned long saved_auxv[40]; /* for /proc/PID/auxv */
 
 	unsigned dumpable:1;
-#ifdef CONFIG_HUGETLB_PAGE
-	int used_hugetlb;
-#endif
 	cpumask_t cpu_vm_mask;
 
 	/* Architecture-specific MM context */
mm/mmap.c +0 -1
diff -urp 6.7-clean/mm/mmap.c 6.7-hugetlb/mm/mmap.c
@@ -318,7 +318,6 @@ static void vma_link(struct mm_struct *m
 	if (mapping)
 		spin_unlock(&mapping->i_mmap_lock);
 
-	mark_mm_hugetlb(mm, vma);
 	mm->map_count++;
 	validate_mm(mm);
 }
#1 lore raw
Quoted 7 lines · Oleg Nesterov

Hello.

mm_struct.used_hugetlb used to eliminate costly find_vma() from follow_page(). Now it is used only in ia64 version of follow_huge_addr(). I know nothing about ia64, but this REGION_NUMBER() looks simple enough to kill used_hugetlb.

Quoted 5 lines

There is debug version (commented out) of follow_huge_addr() in i386 which looks at used_hugetlb, but it can work without this check.

Am i missed somethimg?

Sounds like an excellent idea to me. The find_vma()s were already bogus - no-one used the vma returned by hugepage_vma(), except to check if it was NULL or not. On all archs, whether the address is hugepage or not can be determined from the address, either by walking the pagetables or just by checking the address's range.

Signature · 4 lines
David Gibson			| For every complex problem there is a
david AT gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson