Re: [Vserver] realloc(3)/mremap(2) errors

2005-07-08 Thread Herbert Poetzl
On Fri, Jul 08, 2005 at 07:21:18PM +0200, Herbert Poetzl wrote:
> On Fri, Jul 08, 2005 at 11:32:03AM +0200, Enrico Scholz wrote:
> > [EMAIL PROTECTED] (Enrico Scholz) writes:
> > 
> > > | $ diet gcc x.c
> > > | $ strace ./a.out 
> > > | execve("./a.out", ["./a.out"], [/* 41 vars */]) = 0
> > > | old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 
> > > -1, 0) = 0x97f47000
> > > | mremap(0x97f47000, 4096, 8192, MREMAP_MAYMOVE) = -1 ENOMEM (Cannot 
> > > allocate memory)
> > >~
> > 
> > Is the
> > 
> > | @@ -351,8 +352,13 @@ unsigned long do_mremap(unsigned long ad
> > | ...
> > | }
> > | -   if (!may_expand_vm(current->mm, (new_len - old_len) >> 
> > PAGE_SHIFT)) {
> > | +   if (!may_expand_vm(current->mm, (new_len - old_len) >> 
> > PAGE_SHIFT) ||
> > | +   vx_vmpages_avail(current->mm, (new_len - old_len) >> 
> > PAGE_SHIFT)) {
> > | ret = -ENOMEM;
> > 
> > hunk really correct, or is there missing a '!' before 'vx_vmpages_avail'?
> 
> well, that looks fishy, but a simple ! won't fix it ...

did I say that? D'oh! 

well, to my excuse, line wrapped commented diff hunks are hard to read ...

thanks again,
Herbert

> looking into it right now ...
> 
> thanks,
> Herbert
> 
> > Enrico
> 
> 
> 
> > ___
> > Vserver mailing list
> > Vserver@list.linux-vserver.org
> > http://list.linux-vserver.org/mailman/listinfo/vserver
> 
> ___
> Vserver mailing list
> Vserver@list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver
___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] realloc(3)/mremap(2) errors

2005-07-08 Thread Herbert Poetzl
On Fri, Jul 08, 2005 at 11:32:03AM +0200, Enrico Scholz wrote:
> [EMAIL PROTECTED] (Enrico Scholz) writes:
> 
> > | $ diet gcc x.c
> > | $ strace ./a.out 
> > | execve("./a.out", ["./a.out"], [/* 41 vars */]) = 0
> > | old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
> > 0) = 0x97f47000
> > | mremap(0x97f47000, 4096, 8192, MREMAP_MAYMOVE) = -1 ENOMEM (Cannot 
> > allocate memory)
> >~
> 
> Is the
> 
> | @@ -351,8 +352,13 @@ unsigned long do_mremap(unsigned long ad
> | ...
> | }
> | -   if (!may_expand_vm(current->mm, (new_len - old_len) >> PAGE_SHIFT)) 
> {
> | +   if (!may_expand_vm(current->mm, (new_len - old_len) >> PAGE_SHIFT) 
> ||
> | +   vx_vmpages_avail(current->mm, (new_len - old_len) >> 
> PAGE_SHIFT)) {
> | ret = -ENOMEM;
> 
> hunk really correct, or is there missing a '!' before 'vx_vmpages_avail'?

well, that looks fishy, but a simple ! won't fix it ...
looking into it right now ...

thanks,
Herbert

> Enrico



> ___
> Vserver mailing list
> Vserver@list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver

___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] realloc(3)/mremap(2) errors

2005-07-08 Thread Enrico Scholz
[EMAIL PROTECTED] (Enrico Scholz) writes:

> | $ diet gcc x.c
> | $ strace ./a.out 
> | execve("./a.out", ["./a.out"], [/* 41 vars */]) = 0
> | old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 
> 0) = 0x97f47000
> | mremap(0x97f47000, 4096, 8192, MREMAP_MAYMOVE) = -1 ENOMEM (Cannot allocate 
> memory)
>~

Is the

| @@ -351,8 +352,13 @@ unsigned long do_mremap(unsigned long ad
| ...
| }
| -   if (!may_expand_vm(current->mm, (new_len - old_len) >> PAGE_SHIFT)) {
| +   if (!may_expand_vm(current->mm, (new_len - old_len) >> PAGE_SHIFT) ||
| +   vx_vmpages_avail(current->mm, (new_len - old_len) >> 
PAGE_SHIFT)) {
| ret = -ENOMEM;

hunk really correct, or is there missing a '!' before 'vx_vmpages_avail'?



Enrico


pgp0V5XsD2Xy4.pgp
Description: PGP signature
___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


[Vserver] realloc(3)/mremap(2) errors

2005-07-08 Thread Enrico Scholz
Hi,

just to exclude possible failure-sources (I do not have time to
test a real vanilla 2.6.12.2 kernel, but at least a RH kernel is
fine), does somebody see why code like

| #include 
| int main()
| {
| char *p = malloc(3000);
| realloc(p, 5000);
| }

fails on 2.6.12.2 + patch-2.6.12.2-vs2.0-rc5 in context 0 with

| $ diet gcc x.c
| $ strace ./a.out 
| execve("./a.out", ["./a.out"], [/* 41 vars */]) = 0
| old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x97f47000
| mremap(0x97f47000, 4096, 8192, MREMAP_MAYMOVE) = -1 ENOMEM (Cannot allocate 
memory)
   ~



Enrico


pgprBmZFUgEMy.pgp
Description: PGP signature
___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver