From: CaT <cat@zip.com.au>
To: Christoph Rohland <cr@sap.com>
Cc: Hugh Dickins <hugh@veritas.com>,
tomlins@cam.org, linux-kernel@vger.kernel.org
Subject: Re: PATCH: allow percentile size of tmpfs (2.5.66 / 2.4.20-pre2)
Date: Thu, 3 Apr 2003 20:42:54 +1000 [thread overview]
Message-ID: <20030403104254.GA437@zip.com.au> (raw)
In-Reply-To: <20030403053543.GK2107@zip.com.au>
[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]
On Thu, Apr 03, 2003 at 03:35:43PM +1000, CaT wrote:
> > And I have set it to 400MB on a 256MB box just fine ;-) How could you
>
> :)
>
> > do these two setup generally without knowing your hardware. 20MB tmpfs
>
> If you want to take swap into account you still can't but then this
> patch changes nothing for you in either case. You'd still specify 400MB
> or (now) 156%.
Well, I got bored.
size=<ram>%+<swap>%
So size=100%+50% will set the tmpfs size at 100% the size of your ram
+ 50% the size of your swap.
It's just an idea. It's still simple and gives you what you seem to want
(in part... there's no dynamic changes on swapon/off) and what I want
(the ability to set the size off just real ram).
It seems like a decent compromise so I'm sure someone'll hate it. :)
--
Martin's distress was in contrast to the bitter satisfaction of some
of his fellow marines as they surveyed the scene. "The Iraqis are sick
people and we are the chemotherapy," said Corporal Ryan Dupre. "I am
starting to hate this country. Wait till I get hold of a friggin' Iraqi.
No, I won't get hold of one. I'll just kill him."
- http://www.informationclearinghouse.info/article2479.htm
[-- Attachment #2: add-percentile-ram+swap-size-tmpfs-2.5.66.patch --]
[-- Type: text/plain, Size: 1444 bytes --]
--- mm/shmem.c.old Sun Mar 30 00:51:39 2003
+++ mm/shmem.c Thu Apr 3 20:33:04 2003
@@ -34,6 +34,7 @@
#include <linux/writeback.h>
#include <linux/vfs.h>
#include <asm/uaccess.h>
+#include <asm/div64.h>
/* This magic number is used in glibc for posix shared memory */
#define TMPFS_MAGIC 0x01021994
@@ -1630,6 +1631,25 @@
if (!strcmp(this_char,"size")) {
unsigned long long size;
size = memparse(value,&rest);
+ if (*rest == '%') {
+ size <<= PAGE_SHIFT;
+ size *= totalram_pages;
+ do_div(size, 100);
+ rest++;
+ if(*rest == '+') {
+ unsigned long long swpsize;
+ rest++;
+ value = rest;
+ swpsize = memparse(value,&rest);
+ if (*rest == '%') {
+ swpsize <<= PAGE_SHIFT;
+ swpsize *= nr_swap_pages;
+ do_div(swpsize, 100);
+ rest++;
+ }
+ size+=swpsize;
+ }
+ }
if (*rest)
goto bad_val;
*blocks = size >> PAGE_CACHE_SHIFT;
@@ -1695,7 +1715,6 @@
uid_t uid = current->fsuid;
gid_t gid = current->fsgid;
struct shmem_sb_info *sbinfo;
- struct sysinfo si;
int err = -ENOMEM;
sbinfo = kmalloc(sizeof(struct shmem_sb_info), GFP_KERNEL);
@@ -1708,8 +1727,7 @@
* Per default we only allow half of the physical ram per
* tmpfs instance
*/
- si_meminfo(&si);
- blocks = inodes = si.totalram / 2;
+ blocks = inodes = totalram_pages / 2;
#ifdef CONFIG_TMPFS
if (shmem_parse_options(data, &mode, &uid, &gid, &blocks, &inodes)) {
next prev parent reply other threads:[~2003-04-03 10:30 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
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
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=20030403104254.GA437@zip.com.au \
--to=cat@zip.com.au \
--cc=cr@sap.com \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tomlins@cam.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox