From: Timur Tabi <ttabi@interactivesi.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: kernel hangs in 118th call to vmalloc
Date: Fri, 31 Aug 2001 13:40:54 -0500 [thread overview]
Message-ID: <3B8FDA36.5010206@interactivesi.com> (raw)
I'm writing a driver for the 2.4.2 kernel. I need to use this kernel
because this driver needs to be compatible with a stock Red Hat system.
Patches to the kernel are not an option.
The purpose of the driver is to locate a device that exists on a
specific memory chip. To help find it, I've written this routine:
#define CLEAR_BLOCK_SIZE 1048576UL // must be a multiple of 1MB
#define CLEAR_BLOCK_COUNT ((PHYSICAL_HOP * 2) / CLEAR_BLOCK_SIZE)
void clear_out_memory(void)
{
void *p[CLEAR_BLOCK_COUNT];
unsigned i;
unsigned long size = 0;
for (i=0; i<CLEAR_BLOCK_COUNT; i++)
{
p[i] = vmalloc(CLEAR_BLOCK_SIZE);
if (!p[i])
break;
size += CLEAR_BLOCK_SIZE;
}
while (--i)
vfree(p[i]);
printk("Paged %luMB of memory\n", size / 1048576UL);
}
What this routine does is call vmalloc() repeatedly for a number of 1MB
chunks until it fails or until it's allocated 128MB (CLEAR_BLOCK_COUNT
is equal to 128 in this case). Then, it starts freeing them.
The side-effect of this routine is to page-out up to 128MB of RAM.
Unfortunately, on a 128MB machine, the 118th call to vmalloc() hangs the
system. I was expecting it to return NULL instead.
Is this a bug in vmalloc()? If so, is there a work-around that I can use?
WARNING: multiple messages have this Message-ID (diff)
From: Timur Tabi <ttabi@interactivesi.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: kernel hangs in 118th call to vmalloc
Date: Fri, 31 Aug 2001 13:40:54 -0500 [thread overview]
Message-ID: <3B8FDA36.5010206@interactivesi.com> (raw)
I'm writing a driver for the 2.4.2 kernel. I need to use this kernel
because this driver needs to be compatible with a stock Red Hat system.
Patches to the kernel are not an option.
The purpose of the driver is to locate a device that exists on a
specific memory chip. To help find it, I've written this routine:
#define CLEAR_BLOCK_SIZE 1048576UL // must be a multiple of 1MB
#define CLEAR_BLOCK_COUNT ((PHYSICAL_HOP * 2) / CLEAR_BLOCK_SIZE)
void clear_out_memory(void)
{
void *p[CLEAR_BLOCK_COUNT];
unsigned i;
unsigned long size = 0;
for (i=0; i<CLEAR_BLOCK_COUNT; i++)
{
p[i] = vmalloc(CLEAR_BLOCK_SIZE);
if (!p[i])
break;
size += CLEAR_BLOCK_SIZE;
}
while (--i)
vfree(p[i]);
printk("Paged %luMB of memory\n", size / 1048576UL);
}
What this routine does is call vmalloc() repeatedly for a number of 1MB
chunks until it fails or until it's allocated 128MB (CLEAR_BLOCK_COUNT
is equal to 128 in this case). Then, it starts freeing them.
The side-effect of this routine is to page-out up to 128MB of RAM.
Unfortunately, on a 128MB machine, the 118th call to vmalloc() hangs the
system. I was expecting it to return NULL instead.
Is this a bug in vmalloc()? If so, is there a work-around that I can use?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
next reply other threads:[~2001-08-31 18:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-31 18:40 Timur Tabi [this message]
2001-08-31 18:40 ` kernel hangs in 118th call to vmalloc Timur Tabi
2001-08-31 20:38 ` Alan Cox
2001-08-31 20:38 ` Alan Cox
2001-08-31 20:41 ` Timur Tabi
2001-08-31 20:54 ` Alan Cox
2001-09-08 18:30 ` Eric W. Biederman
2001-09-08 18:30 ` Eric W. Biederman
2001-09-08 19:39 ` Timur Tabi
2001-09-08 19:39 ` Timur Tabi
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=3B8FDA36.5010206@interactivesi.com \
--to=ttabi@interactivesi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.