Skip to contentSkip to conversation

New: Lowmemory exhaustion problem with v2.6.8.1-mm4 16gb

Bug 3268 Hugh Dickins 4 participants 10 messages Aug 25, 2004 – Aug 26, 2004 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 4 lines · keith

Ok I created an attachment in the bug for the slab/buddy/mem info. You can watch zone normal get exhausted :)
http://bugme.osdl.org/show_bug.cgi?id=3268

Thanks. Yes, your lowmem is full of Slab, and that's entirely unsurprising since you have CONFIG_DEBUG_PAGEALLOC on: so every slab object needs a full 4096-byte page to itself (well, there are some exceptions, but that doesn't change the picture).

That's a _very_ distorting config option, and I think this means that your report is of no interest in itself - sorry. But it does raise a valid question whether it can happen in real, non-debug life - thanks.

I'll do the arithmetic on that when I've more leisure: I expect the answer to be that it can happen, and I ought to adjust defaulting of maximum tmpfs inodes.

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 6 lines · Hugh Dickins
Quoted 4 lines · keith

Ok I created an attachment in the bug for the slab/buddy/mem info. You can watch zone normal get exhausted :)
http://bugme.osdl.org/show_bug.cgi?id=3268

Quoted 8 lines

Thanks. Yes, your lowmem is full of Slab, and that's entirely unsurprising since you have CONFIG_DEBUG_PAGEALLOC on: so every slab object needs a full 4096-byte page to itself (well, there are some exceptions, but that doesn't change the picture).

That's a _very_ distorting config option, and I think this means that your report is of no interest in itself - sorry. But it does raise a valid question whether it can happen in real, non-debug life - thanks.

I turned CONFIG_DEBUG_PAGEALLOC off. I ran into problems when I tried building 60 kernel trees or so. It is using about 10gb of tmpfs space. See http://bugme.osdl.org/attachment.cgi?id=3566&action=view for more info.

The bug also contains the config file used.

Quoted 4 lines

I'll do the arithmetic on that when I've more leisure: I expect the answer to be that it can happen, and I ought to adjust defaulting of maximum tmpfs inodes.

It looks like there should be a maximum number of inodes for tmpfs. Because I didn't know how many inodes it is using but I gave it a large playground to use (mount -t tmpfs -o size=15G,nr_inodes=10000k,mode=0700 tmpfs /mytmpfs)

Thanks,
Keith Mannthey

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 2 lines · keith

I turned CONFIG_DEBUG_PAGEALLOC off.

Good, thanks.

Quoted 4 lines

I ran into problems when I tried
building 60 kernel trees or so. It is using about 10gb of tmpfs space. See http://bugme.osdl.org/attachment.cgi?id=3566&action=view for more info.

Okay, that's more to the point.

Quoted 4 lines

It looks like there should be a maximum number of inodes for tmpfs. Because I didn't know how many inodes it is using but I gave it a large playground to use (mount -t tmpfs -o size=15G,nr_inodes=10000k,mode=0700 tmpfs /mytmpfs)

Well, by default it does give you a maximum number of inodes for tmpfs:
which at 16GB of RAM (in 4KB pages: odd that that factors in, but I've no great urge to depart from existing defaults except where it's buggy) would give you 2M inodes. But since each might roughly be expected to consume 1KB (a shmem_inode, a dentry, a longer name, a radix node) of low memory, we'd want 2GB of lowmem to support all those: too much.

So, how well does the patch below work for you, if you leave nr_inodes to its default? Carry on setting size=15G, that should be okay; but I don't think the kernel should stop you if you insist on setting nr_inodes to something unfortunate like 10M. "df -i" will show how many inodes it's actually giving you by default.

Andrew, this paragraph is more for you...
If you examine my 1KB calculation above, you may conclude that this won't be quite the final patch: so long as there's ample swap, the (more than 1) radix nodes shouldn't be a problem since they would melt away under lowmem pressure (hmm, does lowmem shortage exert any pressure on highmem cache these days, I wonder?); but doesn't link(1) imply that dentries can take up almost unlimited space? Looks as if tmpfs ought to be limiting links as it limits inodes.

Hugh

mm/shmem.c +2 -1
@@ -1818,9 +1818,10 @@
 
 	/*
 	 * Per default we only allow half of the physical ram per
-	 * tmpfs instance
+	 * tmpfs instance; limiting inodes to 1 per 2 pages of lowmem.
 	 */
 	blocks = inodes = totalram_pages / 2;
+	inodes -= totalhigh_pages / 2;
 
 #ifdef CONFIG_TMPFS
 	if (shmem_parse_options(data, &mode, &uid, &gid, &blocks, &inodes)) {

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw
Quoted 7 lines · Andrew Morton
Quoted 3 lines · Hugh Dickins

(hmm, does lowmem shortage exert
any pressure on highmem cache these days, I wonder?);

It does, indirectly - when we reclaim an unused inode we also shoot down all that inode's pagecache.

Not much help in the tmpfs case, where the inode cannot get to be unused without being deleted.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw
In reply to Andrew Morton
Quoted 7 lines
Quoted 3 lines · Hugh Dickins

(hmm, does lowmem shortage exert
any pressure on highmem cache these days, I wonder?);

It does, indirectly - when we reclaim an unused inode we also shoot down all that inode's pagecache.

ISTR that causes some fairly major problems under mem pressure - when we go to shrink inode cache, it used to sit there for *ages* trying to free pagecache, particularly if there were a lot of large dirty files. That was a few months back ... but would anything have fixed that case since then?

M.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#7 lore raw
Quoted 6 lines · Martin J. Bligh
Quoted 6 lines
Quoted 3 lines · Hugh Dickins

(hmm, does lowmem shortage exert
any pressure on highmem cache these days, I wonder?);

Quoted 7 lines
Quoted 2 lines

It does, indirectly - when we reclaim an unused inode we also shoot down all that inode's pagecache.

ISTR that causes some fairly major problems under mem pressure - when we go to shrink inode cache, it used to sit there for *ages* trying to free pagecache, particularly if there were a lot of large dirty files. That was a few months back ...

I never saw a report.

Quoted 2 lines

but would anything have fixed that case since then?

No. Probably testing I_DIRTY earlier in prune_icache() would fix it up. --
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#8 lore raw
In reply to Hugh Dickins
Quoted 18 lines · Hugh Dickins
Quoted 2 lines · keith

I turned CONFIG_DEBUG_PAGEALLOC off.

Good, thanks.

Quoted 4 lines

I ran into problems when I tried
building 60 kernel trees or so. It is using about 10gb of tmpfs space. See http://bugme.osdl.org/attachment.cgi?id=3566&action=view for more info.

Okay, that's more to the point.

Quoted 4 lines

It looks like there should be a maximum number of inodes for tmpfs. Because I didn't know how many inodes it is using but I gave it a large playground to use (mount -t tmpfs -o size=15G,nr_inodes=10000k,mode=0700 tmpfs /mytmpfs)

Quoted 6 lines

Well, by default it does give you a maximum number of inodes for tmpfs:
which at 16GB of RAM (in 4KB pages: odd that that factors in, but I've no great urge to depart from existing defaults except where it's buggy) would give you 2M inodes. But since each might roughly be expected to consume 1KB (a shmem_inode, a dentry, a longer name, a radix node) of low memory, we'd want 2GB of lowmem to support all those: too much.

I think there is a need for a hard upper limit to the number of inodes tmpfs can use. With this system I can have 32gb of memory and I also have a 64gb(i386) system. tempfs sizes above 15=g are definitely possible. What about a 40gig tmpfs....

Quoted 6 lines

So, how well does the patch below work for you, if you leave nr_inodes to its default? Carry on setting size=15G, that should be okay; but I don't think the kernel should stop you if you insist on setting nr_inodes to something unfortunate like 10M. "df -i" will show how many inodes it's actually giving you by default.

I was wondering how to do that thanks.
With the patch I only get 82294 inodes. Hmmmm.... I don't have any lowmem issues but I can't create too many files.

Thanks,
Keith Mannthey

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#9 lore raw
Quoted 11 lines
Quoted 6 lines

Well, by default it does give you a maximum number of inodes for tmpfs:
which at 16GB of RAM (in 4KB pages: odd that that factors in, but I've no great urge to depart from existing defaults except where it's buggy) would give you 2M inodes. But since each might roughly be expected to consume 1KB (a shmem_inode, a dentry, a longer name, a radix node) of low memory, we'd want 2GB of lowmem to support all those: too much.

I think there is a need for a hard upper limit to the number of inodes tmpfs can use. With this system I can have 32gb of memory and I also have a 64gb(i386) system. tempfs sizes above 15=g are definitely possible. What about a 40gig tmpfs....

The problem is ... how much mem are you willing to lose? Anything that's unshrinkable is very, very dangerous ... whatever the limit you put on it. But I agree, it'd be better than the current.

Quoted 9 lines
Quoted 5 lines

So, how well does the patch below work for you, if you leave nr_inodes to its default? Carry on setting size=15G, that should be okay; but I don't think the kernel should stop you if you insist on setting nr_inodes to something unfortunate like 10M. "df -i" will show how many inodes it's actually giving you by default.

I was wondering how to do that thanks.
With the patch I only get 82294 inodes. Hmmmm.... I don't have any lowmem issues but I can't create too many files.

Well, you have to pick one or the other ;-)

M.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#10 lore raw
In reply to keith
Quoted 2 lines · keith

With the patch I only get 82294 inodes. Hmmmm.... I don't have any lowmem issues but I can't create too many files.

I get 107701 for my LowTotal 861608 kB, but your LowTotal is 658808 kB.

I'm not saying that default (in your case 82294) is the highest allowable, just a safe default, consistent with what was offered before when no highmem. If the default is to allow half of RAM to be occupied by tmpfs (highmem and swappable) data blocks, it seems appropriate to default to a much smaller fraction of lowmem for the unswappable metadata; but I may be overdoing that, I'm not sure.

I expect in your case (not wanting the lowmem for anything else much) you'll survive with nr_inodes=400000: you can try that, and push it up to breaking point if you like (one reason I don't want to enforce an upper limit in the kernel, just a default). But I don't expect you to survive with nr_inodes=700000.

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>