public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Seth, Rohit" <rohit.seth@intel.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] Update for HugeTLB Page patch for IA-64 2.5.60 kernel
Date: Wed, 26 Feb 2003 22:54:17 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590709805937@msgid-missing> (raw)

[-- 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;

                 reply	other threads:[~2003-02-26 22:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590709805937@msgid-missing \
    --to=rohit.seth@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox