Skip to contentSkip to conversation

hugetlb page patch for 2.5.48-bug fixes

PATCH Rohit Seth 2 participants 2 messages Nov 21, 2002

Subsystems (2)
lore
Share & tools
lore

Rohit Seth

author
#0 lore raw

Linus, Andrew,

Attached is the hugetlbpage patch for 2.5.48 containing following main changes:

1) Bug fixes (mainly in the unsuccessful attempts of hugepages).
2) Removal of Radix Tree field in key structure (as it is not needed).
3) Include the IPC_LOCK for permission to use hugepages.
4) Increment the key_counts during forks.

thanks,
rohit

/include/linux/hugetlb.h renamed from include/linux/hugetlb.h +11 -1
@@ -4,7 +4,17 @@
 #ifdef CONFIG_HUGETLB_PAGE
 
 struct ctl_table;
-struct hugetlb_key;
+struct hugetlb_key {
+	struct page *root;
+	loff_t size;
+	atomic_t count;
+	spinlock_t lock;
+	int key;
+	int busy;
+	uid_t uid;
+	gid_t gid;
+	umode_t mode;
+};
 
 static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
 {
arch/i386/mm/hugetlbpage.c +41 -54

238 lines not on this page · raw message

arch/i386/kernel/sys_i386.c +6 -6
@@ -294,17 +294,17 @@
 {
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma;
-	struct hugetlb_key *key;
 	int retval;
 
-	vma = find_vma(current->mm, addr);
-	if (!vma || !(vma->vm_flags & VM_HUGETLB) || vma->vm_start != addr)
-		return -EINVAL;
 	down_write(&mm->mmap_sem);
-	key = (struct hugetlb_key *)vma->vm_private_data;
+	vma = find_vma(current->mm, addr);
+	if (!vma || !(vma->vm_flags & VM_HUGETLB) || vma->vm_start != addr) {
+		retval =  -EINVAL;
+		goto out;
+	}
 	retval = do_munmap(vma->vm_mm, addr, vma->vm_end - addr);
+out:
 	up_write(&mm->mmap_sem);
-	hugetlb_release_key(key);
 	return retval;
 }
 #else
#1 lore raw
Quoted 7 lines · Rohit Seth

Linus, Andrew,
Attached is the hugetlbpage patch for 2.5.48 containing following main changes:
1) Bug fixes (mainly in the unsuccessful attempts of hugepages).
2) Removal of Radix Tree field in key structure (as it is not needed).
3) Include the IPC_LOCK for permission to use hugepages.
4) Increment the key_counts during forks.

Okay, first off why are you using a list linked through page->private? page->list is fully available for such tasks.

Second, the if (key == NULL) check in hugetlb_release_key() is bogus; someone is forgetting to check for NULL, probably in alloc_shared_hugetlb_pages().

Third, the hugetlb_release_key() in unmap_hugepage_range() is the one that should be removed [along with its corresponding mark_key_busy()], not the one in sys_free_hugepages(). unmap_hugepage_range() is doing neither setup nor teardown of the key itself, only the pages and PTE's. I would say key-level refcounting belongs to sys_free_hugepages().

Bill