From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Cc: Tom Vier <tmv5@home.com>, Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-kernel@vger.kernel.org
Subject: Re: [patch] Re: Linux 2.4.5-ac6
Date: Sat, 9 Jun 2001 14:14:45 +0400 [thread overview]
Message-ID: <20010609141445.A566@jurassic.park.msu.ru> (raw)
In-Reply-To: <20010608181612.A561@jurassic.park.msu.ru> <Pine.GSO.3.96.1010608172843.18837A-100000@delta.ds2.pg.gda.pl>
In-Reply-To: <Pine.GSO.3.96.1010608172843.18837A-100000@delta.ds2.pg.gda.pl>; from macro@ds2.pg.gda.pl on Fri, Jun 08, 2001 at 06:08:46PM +0200
On Fri, Jun 08, 2001 at 06:08:46PM +0200, Maciej W. Rozycki wrote:
> Still it has two loops...
Ok, here is a single loop version.
Ivan.
--- 2.4.5-ac11/mm/mmap.c Fri Jun 8 15:59:35 2001
+++ linux/mm/mmap.c Sat Jun 9 12:50:05 2001
@@ -398,27 +398,37 @@ free_vma:
static inline unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags)
{
struct vm_area_struct *vma;
+ unsigned long addr_limit = TASK_SIZE - len;
+ unsigned long addr1 = 0;
if (len > TASK_SIZE)
return -ENOMEM;
if (addr) {
addr = PAGE_ALIGN(addr);
- vma = find_vma(current->mm, addr);
- if (TASK_SIZE - len >= addr &&
- (!vma || addr + len <= vma->vm_start))
- return addr;
+ if (addr > TASK_UNMAPPED_BASE)
+ addr1 = addr;
+ goto find_free_area;
}
+
+default_area:
addr = PAGE_ALIGN(TASK_UNMAPPED_BASE);
+find_free_area:
for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) {
/* At this point: (!vma || addr < vma->vm_end). */
- if (TASK_SIZE - len < addr)
- return -ENOMEM;
+ if (addr_limit < addr)
+ break;
if (!vma || addr + len <= vma->vm_start)
return addr;
addr = vma->vm_end;
}
+ if (addr1) {
+ /* No unmapped areas above addr; try below it */
+ addr_limit = addr1;
+ goto default_area;
+ }
+ return -ENOMEM;
}
#else
extern unsigned long arch_get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
--- 2.4.5-ac11/include/linux/binfmts.h Mon Jun 4 14:19:00 2001
+++ linux/include/linux/binfmts.h Mon Jun 4 20:24:50 2001
@@ -32,6 +32,9 @@ struct linux_binprm{
unsigned long loader, exec;
};
+/* Forward declaration */
+struct mm_struct;
+
/*
* This structure defines the functions that are used to load the binary formats that
* linux accepts.
next prev parent reply other threads:[~2001-06-09 10:18 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-01 11:01 Alan Cox
2001-06-01 11:28 ` Alexander Viro
2001-06-01 11:52 ` Alan Cox
2001-06-01 12:23 ` Keith Owens
2001-06-02 2:27 ` Tom Vier
2001-06-04 10:16 ` Maciej W. Rozycki
2001-06-04 17:08 ` [patch] " Ivan Kokshaysky
2001-06-05 15:11 ` Maciej W. Rozycki
2001-06-05 17:41 ` Ivan Kokshaysky
2001-06-05 18:32 ` Maciej W. Rozycki
2001-06-06 5:37 ` Ivan Kokshaysky
2001-06-06 13:09 ` Maciej W. Rozycki
2001-06-06 14:49 ` Jeff Garzik
2001-06-06 17:26 ` Maciej W. Rozycki
2001-06-07 17:48 ` Ivan Kokshaysky
2001-06-07 18:31 ` Maciej W. Rozycki
2001-06-08 10:18 ` jlnance
2001-06-08 17:06 ` Gerhard Mack
2001-06-08 14:18 ` Ivan Kokshaysky
2001-06-07 17:20 ` Ivan Kokshaysky
2001-06-07 18:28 ` Maciej W. Rozycki
2001-06-08 14:16 ` Ivan Kokshaysky
2001-06-08 16:08 ` Maciej W. Rozycki
2001-06-08 17:23 ` Ivan Kokshaysky
2001-06-09 10:14 ` Ivan Kokshaysky [this message]
2001-06-09 18:46 ` Tom Vier
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=20010609141445.A566@jurassic.park.msu.ru \
--to=ink@jurassic.park.msu.ru \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=macro@ds2.pg.gda.pl \
--cc=tmv5@home.com \
/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
all inboxes | Powered by JetHome®