(This applies on top of Nick's second tiny-shmem patch, which hasn't
made it to mainline yet(!). But as this deletes tiny-shmem.c, you can
probably ignore the rejects.)
tiny-shmem shares most of its 130 lines of code with shmem and tends
to break when particular bits of shmem get modified. Unifying saves
code and makes keeping these two in sync much easier.
before:
14367 392 24 14783 39bf mm/shmem.o
396 72 8 476 1dc mm/tiny-shmem.o
after:
14367 392 24 14783 39bf mm/shmem.o
412 72 8 492 1ec mm/shmem.o tiny
Signed-off-by: Matt Mackall <mpm@selenic.com>
diff -r 04ceba0d1126 -r 4d75a71b1e9d init/Kconfig
--- a/init/Kconfig Tue Sep 30 15:36:27 2008 -0500
+++ b/init/Kconfig Tue Sep 30 18:44:12 2008 -0500
@@ -805,10 +805,6 @@
boolean
select PLIST
-config TINY_SHMEM
- default !SHMEM
- bool
-
config BASE_SMALL
int
default 0 if BASE_FULL
diff -r 04ceba0d1126 -r 4d75a71b1e9d mm/Makefile
--- a/mm/Makefile Tue Sep 30 15:36:27 2008 -0500
+++ b/mm/Makefile Tue Sep 30 18:44:12 2008 -0500
@@ -9,7 +9,7 @@
obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
maccess.o page_alloc.o page-writeback.o pdflush.o \
- readahead.o swap.o truncate.o vmscan.o \
+ readahead.o swap.o truncate.o vmscan.o shmem.o \
prio_tree.o util.o mmzone.o vmstat.o backing-dev.o \
page_isolation.o mm_init.o $(mmu-y)
@@ -21,9 +21,7 @@
obj-$(CONFIG_NUMA) += mempolicy.o
obj-$(CONFIG_SPARSEMEM) += sparse.o
obj-$(CONFIG_SPARSEMEM_VMEMMAP) += sparse-vmemmap.o
-obj-$(CONFIG_SHMEM) += shmem.o
obj-$(CONFIG_TMPFS_POSIX_ACL) += shmem_acl.o
-obj-$(CONFIG_TINY_SHMEM) += tiny-shmem.o
obj-$(CONFIG_SLOB) += slob.o
obj-$(CONFIG_MMU_NOTIFIER) += mmu_notifier.o
obj-$(CONFIG_SLAB) += slab.o
diff -r 04ceba0d1126 -r 4d75a71b1e9d mm/shmem.c
--- a/mm/shmem.c Tue Sep 30 15:36:27 2008 -0500
+++ b/mm/shmem.c Tue Sep 30 18:44:12 2008 -0500
@@ -14,31 +14,39 @@
* Copyright (c) ...Works with my test program: http://people.redhat.com/~dhowells/doshm.c Compile and run: doshm sysv warthog>size mm/tiny-shmem.o text data bss dec hex filename 788 36 4 828 33c mm/tiny-shmem.o warthog>size mm/shmem.o text data bss dec hex filename 832 36 4 872 368 mm/shmem.o Acked-by: David Howells <dhowells@redhat.com> --
Gosh, thanks for mentioning that, you're right, it hasn't. I saw
git pull updating mm/tiny-shmem.c a few days ago, and took it for
granted that that was the #ifndef CONFIG_MMU fixed version; but it
was the earlier one without that fix, despite us all knowing that
fix was needed. I'd have pushed it myself for -rc8 if I'd realized
it was still missing: Nick, please push it to Linus a.s.a.p. (with
Acks from Matt and David and me) - or ask me to do so (I'm not sure
That's much nicer than I'd been imagining, thanks Matt: I've no qualms
about the few #ifdefs you're adding to mm/shmem.c, it does seem an
outright improvement that you're bringing them together.
(It's slightly confusing that !CONFIG_SHMEM now builds mm/shmem.c;
This ifndef is the ugliest part of it: and looking into it, guess
what, shmem_get_unmapped_area() hasn't been used since 2.6.20 -
that's right, isn't it, David?
So please make a separate preliminary patch to remove it from
mm/tiny-shmem.c and include/linux/mm.h, so that little ugliness
never gets here - or if you think that's the wrong way around,
I'd prefer to rearrange that:
#define shmem_vm_ops generic_file_vm_ops
#define shmem_file_operations ramfs_file_operations
#define shmem_get_inode ramfs_get_inode
#define shmem_acct_size(a, b) 0
#define shmem_unacct_size(a, b) do { } while (0)
#define SHMEM_MAX_BYTES LLONG_MAX
Your LONG_MAX is too limiting, since it's on a loff_t:
CONFIG_SHMEM limits files according to the range of its swap
tables, but ramfs doesn't require that extra limitation, and
LONG_MAX could be too small on 32-bit. And hopefully gcc will
On a different but related subject:
do you think we need to retain the CONFIG_TMPFS option? It's rather
odd these days, since everybody gets ramfs, and you give them tmpfs
via ramfs without CONFIG_SHMEM. If anybody wants to cut out the
TMPFS code overhead these days, wouldn't they be using !CONFIG_SHMEM?
Hugh
--
Linus must have missed it I guess, because I think I did address it to him. If you or Matt or Andrew push it up, it might get taken seriously ;) --
I agree, it's pretty hard to see a situation where you'd want full swap-backed shm and not full swap-backed tmpfs. I'll spin up a patch to follow on my unification. -- Mathematics is the supreme nostalgia of our time. --
It's not an outright improvement. shmem.o is still larger than tiny-shmem.o, Ummm... It seems to be. I think it used to be used by SYSV SHM. Certainly deleting that function causes no link problems. David --
Here the difference comes down to 16 bytes for the "if (size < 0)" I've got a patch queued to drop it, will post shortly. -- Mathematics is the supreme nostalgia of our time. --
