linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: PATCH: allow percentile size of tmpfs (2.5.66 / 2.4.20-pre2)
@ 2003-04-01 14:22 Mikael Starvik
  2003-04-01 16:24 ` Christoph Rohland
  0 siblings, 1 reply; 38+ messages in thread
From: Mikael Starvik @ 2003-04-01 14:22 UTC (permalink / raw)
  To: 'tomlins@cam.org', 'CaT',
	'linux-kernel@vger.kernel.org'

>What does tmpfs have to do with ram size?  Its swappable.  This _might_ be
>useful for ramfs but for tmpfs, IMHO, its not a good idea.

All systems that uses tmpfs doesn't necessairly have a swap, 
tmpfs is used in several diskless embedded systems.

/Mikael

^ permalink raw reply	[flat|nested] 38+ messages in thread
* PATCH: allow percentile size of tmpfs (2.5.66 / 2.4.20-pre2)
@ 2003-04-01  8:10 CaT
  2003-04-01 10:59 ` Xavier Bestel
  0 siblings, 1 reply; 38+ messages in thread
From: CaT @ 2003-04-01  8:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Torvalds, Marcelo Tosatti, Alan Cox

[-- Attachment #1: Type: text/plain, Size: 1347 bytes --]

I believe the patch below will apply to both the above (I know it does
to 2.5.66 and 2.4.20-pre2 mm/shmem.c does not look any different so it
should be fine. :)

Anyways, what this patch does is allow you to specify the max amount of
memory tmpfs can use as a percentage of available real ram. This (in my
eyes) is useful so that you do not have to remember to change the
setting if you want something other then 50% and some of your ram does
(and you can't replacew it immediately).

Usage of this option is as follows:

tmpfs      /dev/shm tmpfs  rw,size=63%,noauto            0 0

This is taken from my working system and sets the tmpfs size to 63% of
my real RAM (256MB). The end result is:

Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/shm/tmp            160868      6776    154092   5% /tmp

I've also tested remounting to silly values (and sane ones) and it all
works fine with no oopses or freezes and the correct values appearing
in df.

All up I feel safer using this then a hard value.

Please apply. :)

-- 
"Other countries of course, bear the same risk. But there's no doubt his
hatred is mainly directed at us. After all this is the guy who tried to
kill my dad."
        - George W. Bush Jr, Leader of the United States Regime
          September 26, 2002 (from a political fundraiser in Houston, Texas)

[-- Attachment #2: add-perc-tmpfs-size-2.5.66.patch --]
[-- Type: text/plain, Size: 441 bytes --]

--- linux/mm/shmem.c.old	Sun Mar 30 00:51:39 2003
+++ linux/mm/shmem.c	Sun Mar 30 03:23:47 2003
@@ -1630,6 +1630,12 @@
 		if (!strcmp(this_char,"size")) {
 			unsigned long long size;
 			size = memparse(value,&rest);
+			if (*rest == '%') {
+				struct sysinfo si;
+				si_meminfo(&si);
+				size = (si.totalram << PAGE_CACHE_SHIFT) / 100 * size;
+				rest++;
+			}
 			if (*rest)
 				goto bad_val;
 			*blocks = size >> PAGE_CACHE_SHIFT;

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2003-04-07 11:48 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <fa.eagpkml.m3elbd@ifi.uio.no>
2003-04-01 13:38 ` PATCH: allow percentile size of tmpfs (2.5.66 / 2.4.20-pre2) Ed Tomlinson
2003-04-01 14:17   ` Hugh Dickins
2003-04-01 14:18   ` CaT
2003-04-01 16:27   ` Christoph Rohland
2003-04-01 16:45     ` Hugh Dickins
2003-04-02  7:20       ` Christoph Rohland
2003-04-02  8:12         ` William Lee Irwin III
2003-04-02 14:44         ` CaT
2003-04-02 17:33           ` Christoph Rohland
2003-04-02 20:44             ` Jörn Engel
2003-04-02 21:04               ` Hugh Dickins
2003-04-03  7:44                 ` Jörn Engel
2003-04-07  8:32                 ` Christoph Rohland
2003-04-07 11:55                   ` Hugh Dickins
2003-04-07 11:59                     ` Christoph Rohland
2003-04-04 11:31               ` Henning P. Schmiedehausen
2003-04-03  5:35             ` CaT
2003-04-03 10:42               ` CaT
2003-04-02 10:04     ` Jörn Engel
2003-04-03  2:54     ` Robert White
2003-04-03  8:35       ` Hugh Dickins
2003-04-03 20:55         ` Robert White
2003-04-01 14:22 Mikael Starvik
2003-04-01 16:24 ` Christoph Rohland
2003-04-01 18:26   ` Daniel Egger
2003-04-01 19:25     ` Hugh Dickins
2003-04-01 19:57       ` Daniel Egger
2003-04-02  7:13     ` Christoph Rohland
2003-04-02  7:55       ` Hua Zhong
2003-04-02 10:26         ` Hugh Dickins
2003-04-03  2:49         ` Robert White
2003-04-03  2:54           ` Hua Zhong
  -- strict thread matches above, loose matches on Subject: below --
2003-04-01  8:10 CaT
2003-04-01 10:59 ` Xavier Bestel
2003-04-01 11:11   ` Hugh Dickins
2003-04-01 14:23     ` CaT
2003-04-01 14:43       ` Hugh Dickins
2003-04-01 14:54         ` CaT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).