public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] Update for HugeTLB Page patch for IA-64 2.5.60 kernel
@ 2003-02-26 22:54 Seth, Rohit
  0 siblings, 0 replies; only message in thread
From: Seth, Rohit @ 2003-02-26 22:54 UTC (permalink / raw)
  To: linux-ia64

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

Please find attached a small hugetlb page support update for 2.5.60
IA-64 kernel (+ my previous hugetlb page patch).  This patch adds the
HAVE_ARCH_HUGETLB_UNMAPPED_AREA define for IA-64 arch.
hugetlb_get_unmapped_area function is added in
arch/ia64/mm/hugetlbpage.c

thanks,
rohit






[-- Attachment #2: patch2560u1 --]
[-- Type: application/octet-stream, Size: 2201 bytes --]

--- include/asm-ia64/page.h.1	Wed Feb 26 14:07:27 2003
+++ include/asm-ia64/page.h	Wed Feb 26 14:17:29 2003
@@ -57,6 +57,7 @@
 # define REGION_SHIFT	61
 # define HPAGE_SIZE	(__IA64_UL_CONST(1) << HPAGE_SHIFT)
 # define HPAGE_MASK	(~(HPAGE_SIZE - 1))
+# define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 #endif /* CONFIG_HUGETLB_PAGE */
 
 #ifdef __ASSEMBLY__
--- arch/ia64/kernel/sys_ia64.c.1	Wed Feb 26 14:02:33 2003
+++ arch/ia64/kernel/sys_ia64.c	Wed Feb 26 14:03:08 2003
@@ -33,17 +33,8 @@
 		return -ENOMEM;
 
 #ifdef CONFIG_HUGETLB_PAGE
-#define COLOR_HALIGN(addr) ((addr + HPAGE_SIZE - 1) & ~(HPAGE_SIZE - 1))
-#define TASK_HPAGE_BASE ((REGION_HPAGE << REGION_SHIFT) | HPAGE_SIZE)
-	if (filp && is_file_hugepages(filp)) {
-		if ((REGION_NUMBER(addr) != REGION_HPAGE) || (addr & (HPAGE_SIZE -1)))
-			addr = TASK_HPAGE_BASE;
-		addr = COLOR_HALIGN(addr);
-	}
-	else {
-		if (REGION_NUMBER(addr) == REGION_HPAGE)
-			addr = 0;
-	}
+	if (REGION_NUMBER(addr) == REGION_HPAGE)
+		addr = 0;
 #endif
 	if (!addr)
 		addr = TASK_UNMAPPED_BASE;
--- arch/ia64/mm/hugetlbpage.c.1	Wed Feb 26 12:34:59 2003
+++ arch/ia64/mm/hugetlbpage.c	Wed Feb 26 14:27:48 2003
@@ -19,6 +19,8 @@
 
 #include <linux/sysctl.h>
 
+#define TASK_HPAGE_BASE (REGION_HPAGE << REGION_SHIFT)
+
 static long    htlbpagemem;
 int     htlbpage_max;
 static long    htlbzone_pages;
@@ -312,6 +314,29 @@
 	return ret;
 }
 
+unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
+		unsigned long pgoff, unsigned long flags)
+{
+	struct vm_area_struct *vmm;
+
+	if (len > RGN_MAP_LIMIT)
+		return -ENOMEM;
+	if (len & ~HPAGE_MASK)
+		return -EINVAL;
+	/* This code assumes that REGION_HPAGE != 0. */
+	if ((REGION_NUMBER(addr) != REGION_HPAGE) || (addr & (HPAGE_SIZE - 1)))
+		addr = TASK_HPAGE_BASE;
+	else
+		addr = ALIGN(addr, HPAGE_SIZE);
+	for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
+		/* At this point:  (!vmm || addr < vmm->vm_end). */
+		if (REGION_OFFSET(addr) + len > RGN_MAP_LIMIT)
+			return -ENOMEM;
+		if (!vmm || (addr + len) <= vmm->vm_start)
+			return addr;
+		addr = ALIGN(vmm->vm_end, HPAGE_SIZE);
+	}
+}
 void update_and_free_page(struct page *page)
 {
 	int j;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-26 22:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-26 22:54 [Linux-ia64] Update for HugeTLB Page patch for IA-64 2.5.60 kernel Seth, Rohit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox