Thanks for David and Eric's suggestion! Before I submit the updated patch I would like to show some testing result under mips arch. I used NPB3.3-SER as the benchmark to test libhugetlbfs for MIPS, here is a sample result:
====================================================================== BEFORE using libhugetlbfs for MIPS: IS Benchmark Completed Class = A Size = 8388608 Iterations = 10 Time in seconds = 25.54 Mop/s total = 3.29 ---------------------------------------------------------------- AFTER using libhugetlbfs for MIPS: #hugeedit --text --data ./bin/is.A #HUGETLB_ELFMAP=RW ./bin/is.A IS Benchmark Completed Class = A Size = 8388608 Iterations = 10 Time in seconds = 8.74 Mop/s total = 9.60 ======================================================================= From the result we can see that after using libhugetlbfs operations per second of IS increased from 3.29Mop/s to 9.60Mop/s. That's a significant improvement! The patch will be shown in another mail. 于 2011/6/6 11:56, David Gibson Wrote: > On Sun, Jun 05, 2011 at 05:01:46PM +0800, Yu Huang wrote: >> 于 2011/6/4 15:22, David Gibson Wrote: >>> Uh, you need the -u option to diff. Plain-style diffs are more or >>> less unusable as patches. >>> >> Thanks you! Here is a new patch with -u option: >> >> >> diff -ruN libhugetlbfs-2.12-x86/ld.hugetlbfs >> libhugetlbfs-2.12-mips/ld.hugetlbfs >> --- libhugetlbfs-2.12-x86/ld.hugetlbfs 2011-04-02 04:39:44.000000000 +0800 >> +++ libhugetlbfs-2.12-mips/ld.hugetlbfs 2011-06-10 06:55:26.000000000 +0800 >> @@ -73,6 +73,7 @@ >> MB=$((1024*1024)) >> case "$EMU" in >> elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;; >> +elf32ltmips|elf64ltmips) HPAGE_SIZE=$((32*$MB)) SLICE_SIZE=$((32*$MB));; > Unless MIPS has something similar to the "slices" on PPC, which is > unlikely, you should set SLICE_SIZE to HPAGE_SIZE explicitly, rather > than just equal values, it makes what's going on clearer. > >> elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;; >> esac >> >> diff -ruN libhugetlbfs-2.12-x86/ldscripts/elf32ltmips.xB >> libhugetlbfs-2.12-mips/ldscripts/elf32ltmips.xB >> --- libhugetlbfs-2.12-x86/ldscripts/elf32ltmips.xB 1970-01-01 >> 08:00:00.000000000 +0800 >> +++ libhugetlbfs-2.12-mips/ldscripts/elf32ltmips.xB 2011-06-10 >> 06:30:12.000000000 +0800 >> @@ -0,0 +1 @@ >> + >> diff -ruN libhugetlbfs-2.12-x86/ldscripts/elf32ltmips.xBDT >> libhugetlbfs-2.12-mips/ldscripts/elf32ltmips.xBDT >> --- libhugetlbfs-2.12-x86/ldscripts/elf32ltmips.xBDT 1970-01-01 >> 08:00:00.000000000 +0800 >> +++ libhugetlbfs-2.12-mips/ldscripts/elf32ltmips.xBDT 2011-06-10 >> 06:30:42.000000000 +0800 >> @@ -0,0 +1 @@ >> + >> diff -ruN libhugetlbfs-2.12-x86/ldscripts/elf64ltmips.xB >> libhugetlbfs-2.12-mips/ldscripts/elf64ltmips.xB >> --- libhugetlbfs-2.12-x86/ldscripts/elf64ltmips.xB 1970-01-01 >> 08:00:00.000000000 +0800 >> +++ libhugetlbfs-2.12-mips/ldscripts/elf64ltmips.xB 2011-06-10 >> 06:30:26.000000000 +0800 >> @@ -0,0 +1 @@ >> + >> diff -ruN libhugetlbfs-2.12-x86/ldscripts/elf64ltmips.xBDT >> libhugetlbfs-2.12-mips/ldscripts/elf64ltmips.xBDT >> --- libhugetlbfs-2.12-x86/ldscripts/elf64ltmips.xBDT 1970-01-01 >> 08:00:00.000000000 +0800 >> +++ libhugetlbfs-2.12-mips/ldscripts/elf64ltmips.xBDT 2011-06-10 >> 06:30:37.000000000 +0800 >> @@ -0,0 +1 @@ >> + > You've added empty files for the link scripts, which is silly. It's > probably not worth implementing the old-style linker script based > mapping system on a new platform - the new approach is much more > robust. We should just fix the test scripts so that it won't even > attempt to test the old style technique on new architectures that > don't implement it. > >> diff -ruN libhugetlbfs-2.12-x86/Makefile libhugetlbfs-2.12-mips/Makefile >> --- libhugetlbfs-2.12-x86/Makefile 2011-04-02 04:39:44.000000000 +0800 >> +++ libhugetlbfs-2.12-mips/Makefile 2011-06-10 06:55:51.000000000 +0800 >> @@ -17,7 +17,7 @@ >> INSTALL_MAN7 = libhugetlbfs.7 >> INSTALL_MAN8 = hugectl.8 hugeedit.8 hugeadm.8 cpupcstat.8 >> LDSCRIPT_TYPES = B BDT >> -LDSCRIPT_DIST_ELF = elf32ppclinux elf64ppc elf_i386 elf_x86_64 >> +LDSCRIPT_DIST_ELF = elf32ppclinux elf64ppc elf_i386 elf_x86_64 elf32ltmips >> INSTALL_OBJSCRIPT = ld.hugetlbfs >> VERSION=version.h >> SOURCE = $(shell find . -maxdepth 1 ! -name version.h -a -name '*.[h]') >> @@ -80,6 +80,13 @@ >> TMPLIB32 = lib >> CFLAGS += -DNO_ELFLINK >> else >> +ifeq ($(ARCH),mips64) >> +CC64 = gcc >> +CC32 = gcc > This can't possibly be right. These two must be different to generate > different binaries for 32-bit and 64-bit builds. You probably want > "gcc -m32" and "gcc -m64", assuming MIPS has a biarch compiler these > days. > >> +TMPLIB64 = lib64 >> +ELF32= elf32ltmips >> +ELF64= elf64ltmips >> +else >> $(error "Unrecognized architecture ($(ARCH))") >> endif >> endif >> @@ -88,6 +95,7 @@ >> endif >> endif >> endif >> +endif >> >> ifdef CC32 >> OBJDIRS += obj32 >> @@ -187,7 +195,11 @@ >> export LIBDIR32 >> export LIBDIR64 >> >> +ifeq ($(ARCH),mips64) >> +all: libs tools >> +else >> all: libs tests tools >> +endif > This is bad. You want to get the testsuite working on MIPS, not > bypass it. > >> .PHONY: tests libs >> >> diff -ruN libhugetlbfs-2.12-x86/sys-elf32ltmips.S >> libhugetlbfs-2.12-mips/sys-elf32ltmips.S >> --- libhugetlbfs-2.12-x86/sys-elf32ltmips.S 1970-01-01 >> 08:00:00.000000000 +0800 >> +++ libhugetlbfs-2.12-mips/sys-elf32ltmips.S 2011-06-10 >> 08:36:59.000000000 +0800 >> @@ -0,0 +1,72 @@ >> +/* >> +.text >> +.globl direct_syscall >> +direct_syscall: >> +syscall >> +j $ra >> +*/ >> + >> +/* code port from >> + * glibc-2.1.3.tar.gz/glibc-2.1.3/sysdeps/mach/mips/syscall.S >> + */ >> + >> + >> +#define zero $0 /* wired zero */ >> +#define AT $1 /* assembler temp - uppercase because of ".set at" >> + */ >> +#define v0 $2 /* return value */ >> +#define v1 $3 >> +#define a0 $4 /* argument registers */ >> +#define a1 $5 >> +#define a2 $6 >> +#define a3 $7 >> +#define t0 $8 /* caller saved */ >> +#define t1 $9 >> +#define t2 $10 >> +#define t3 $11 >> +#define t4 $12 >> +#define t5 $13 >> +#define t6 $14 >> +#define t7 $15 >> +#define s0 $16 /* callee saved */ >> +#define s1 $17 >> +#define s2 $18 >> +#define s3 $19 >> +#define s4 $20 >> +#define s5 $21 >> +#define s6 $22 >> +#define s7 $23 >> +#define t8 $24 /* caller saved */ >> +#define t9 $25 >> +#define jp $25 /* PIC jump register */ >> +#define k0 $26 /* kernel scratch */ >> +#define k1 $27 >> +#define gp $28 /* global pointer */ >> +#define sp $29 /* stack pointer */ >> +#define fp $30 /* frame pointer */ >> +#define s8 $30 /* same like fp! */ >> +#define ra $31 /* return address >> + */ >> + >> + >> +.text >> +.globl direct_syscall >> + >> +direct_syscall: >> +move v0, a0 /* Load system call number from first arg. */ >> +move a0, a1 /* Move the next three args up a register. */ >> +move a1, a2 >> +move a2, a3 >> + >> +/* Load the remaining possible args (up to 11) from the stack. */ >> + >> +ld t0,4*8(sp) >> +ld t1,5*8(sp) >> +ld t2,6*8(sp) >> +ld t3,7*8(sp) >> +ld t4,8*8(sp) >> +ld t5,9*8(sp) >> +ld t6,10*8(sp) >> +syscall /* Do the system call. */ >> +j ra /* Return to caller. */ >> + >> diff -ruN libhugetlbfs-2.12-x86/sys-elf64ltmips.S >> libhugetlbfs-2.12-mips/sys-elf64ltmips.S >> --- libhugetlbfs-2.12-x86/sys-elf64ltmips.S 1970-01-01 >> 08:00:00.000000000 +0800 >> +++ libhugetlbfs-2.12-mips/sys-elf64ltmips.S 2011-06-10 >> 08:37:16.000000000 +0800 >> @@ -0,0 +1,5 @@ >> +.text >> +.globl direct_syscall >> +direct_syscall: >> + syscall >> + j $ra >> >> -- Huang Yu ICT. Chinese Academy of Sciences. ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel