hugetlbpage.c | 31 ++++++++++++++++++++-----------
1 files changed, 20 insertions(+), 11 deletions(-)
diff -urpN htlb-2.5.47-2/arch/i386/mm/hugetlbpage.c htlb-2.5.47-3/arch/i386/mm/hugetlbpage.c
--- htlb-2.5.47-2/arch/i386/mm/hugetlbpage.c 2002-11-11 21:08:00.000000000 -0800
+++ htlb-2.5.47-3/arch/i386/mm/hugetlbpage.c 2002-11-11 21:23:55.000000000 -0800
@@ -101,6 +101,23 @@ struct hugetlb_key *alloc_key(int key, u
return (struct hugetlb_key *)inode;
}
+static void release_key(struct hugetlb_key *key)
+{
+ int i;
+ struct inode *inode = (struct inode *)key;;
+
+ spin_lock(&htlbpage_lock);
+ for(i = 0;i < MAX_ID; ++i)
+ if (htlbpagek[i].key != inode->i_ino)
+ continue;
+
+ BUG_ON(i >= MAX_ID);
+ htlbpagek[i].key = 0;
+ htlbpagek[i].in = NULL;
+ kfree(inode);
+ spin_unlock(&htlbpage_lock);
+}
+
static struct page *alloc_hugetlb_page(void)
{
int i;
@@ -339,7 +356,6 @@ static int alloc_shared_hugetlb_pages(in
struct vm_area_struct *vma;
struct inode *inode;
struct address_space *mapping;
- int idx;
int retval = -ENOMEM;
int newalloc = 0;
@@ -390,16 +406,9 @@ out:
return retval;
out_err: spin_unlock(&htlbpage_lock);
freeinode:
- if (newalloc) {
- for(idx=0;idx<MAX_ID;idx++)
- if (htlbpagek[idx].key == inode->i_ino) {
- htlbpagek[idx].key = 0;
- htlbpagek[idx].in = NULL;
- break;
- }
- kfree(inode);
- }
- return retval;
+ if (newalloc)
+ release_key((struct hugetlb_key *)inode);
+ return retval;
}
int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/