From: Pete Popov <ppopov@pacbell.net>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Phil Thompson <phil@river-bank.demon.co.uk>,
Linux/MIPS Development <linux-mips@oss.sgi.com>
Subject: Re: pgd_init() Patch
Date: 28 Jan 2002 12:03:19 -0800 [thread overview]
Message-ID: <1012248199.19952.111.camel@zeus> (raw)
In-Reply-To: <Pine.GSO.4.21.0201282052240.2836-100000@vervain.sonytel.be>
[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]
On Mon, 2002-01-28 at 11:53, Geert Uytterhoeven wrote:
> On Mon, 28 Jan 2002, Phil Thompson wrote:
> > - USER_PTRS_PER_PGD is defined as TASK_SIZE/PGDIR_SIZE. However,
> > because, TASK_SIZE is actually defined as one less that the maximum task
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > size there is a rounding error that means that USER_PTRS_PER_PGD works
> ^^^^
> > out at 511 rather than 512. This means that entries 511 and 1023 of
> > swapper_pg_dir don't get initialised.
> >
> > The corresponding mips64 code has only the first call to pgd_init() and
> > each implementation of pgd_init() initialises PTRS_PER_PGD entries,
> > where PTRS_PER_PGD is simple defined as 1024.
> >
> > The attached patch applies the mips64 approach to the mips code.
> >
> > Should USER_PTRS_PER_PGD be defined as (TASK_SIZE/PGDIR_SIZE) + 1?
>
> You mean ((TASK_SIZE)+1)/PGDIR_SIZE?
Or how about:
#define USER_PTRS_PER_PGD ((TASK_SIZE-1)/PGDIR_SIZE + 1)
The above patch fixes a rather serious memory leak. When a parent
process forks a large number of children and then it exits before the
children exit, we lose one page per child. I was able to narrow down the
problem and reproduce it with the attached program. Ralf has the fix,
but was examining related issues before applying the patch.
Pete
[-- Attachment #2: mleak.c --]
[-- Type: text/x-c, Size: 394 bytes --]
#include <signal.h>
#define NUM_TSK 200
int main()
{
int i, lastp;
int pids[NUM_TSK];
printf("mypid %d\n", getpid());
for (i=0; i<NUM_TSK; i++) {
switch (pids[i] = fork()) {
case -1:
printf("fork failed, lastp %d\n", lastp);
goto killall;
case 0:
sleep(4);
return 0;
break;
default:
lastp = i;
}
}
killall:
return 0;
}
next prev parent reply other threads:[~2002-01-28 21:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-28 13:36 pgd_init() Patch Phil Thompson
2002-01-28 19:53 ` Geert Uytterhoeven
2002-01-28 20:03 ` Pete Popov [this message]
2002-01-28 20:04 ` Jun Sun
2002-01-28 20:26 ` Geert Uytterhoeven
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=1012248199.19952.111.camel@zeus \
--to=ppopov@pacbell.net \
--cc=geert@linux-m68k.org \
--cc=linux-mips@oss.sgi.com \
--cc=phil@river-bank.demon.co.uk \
/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