Revision f43ba60e2c3bec4925eee229fa0f420dd1296f0c authored by Linus Torvalds on 13 April 2006, 17:01:02 UTC, committed by Junio C Hamano on 13 April 2006, 18:26:56 UTC
This trivially avoids keeping the commit message data around after we
don't need it any more, avoiding a continually growing "git log" memory
footprint.

It's not a huge deal, but it's somewhat noticeable. For the current kernel
tree, doing a full "git log" I got

 - before: /usr/bin/time git log > /dev/null
	0.81user 0.02system 0:00.84elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+8851minor)pagefaults 0swaps

 - after: /usr/bin/time git log > /dev/null
	0.79user 0.03system 0:00.83elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+5039minor)pagefaults 0swaps

ie the touched pages dropped from 8851 to 5039. For the historic kernel
archive, the numbers are 18357->11037 minor page faults.

We could/should in theory free the commits themselves, but that's really a
lot harder, since during revision traversal we may hit the same commit
twice through different children having it as a parent, even after we've
shown it once (when that happens, we'll silently ignore it next time, but
we still need the "struct commit" to know).

And as the commit message data is clearly the biggest part of the commit,
this is the really easy 60% solution.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent d533524
Raw File
t4112-apply-renames.sh
#!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano
#

test_description='git-apply should not get confused with rename/copy.

'

. ./test-lib.sh

# setup

mkdir -p include/arch/x86_64/klibc klibc/arch/x86_64/include/klibc

cat >include/arch/x86_64/klibc/archsetjmp.h <<\EOF
/*
 * arch/x86_64/include/klibc/archsetjmp.h
 */

#ifndef _KLIBC_ARCHSETJMP_H
#define _KLIBC_ARCHSETJMP_H

struct __jmp_buf {
  unsigned long __rbx;
  unsigned long __rsp;
  unsigned long __rbp;
  unsigned long __r12;
  unsigned long __r13;
  unsigned long __r14;
  unsigned long __r15;
  unsigned long __rip;
};

typedef struct __jmp_buf jmp_buf[1];

#endif /* _SETJMP_H */
EOF

cat >klibc/arch/x86_64/include/klibc/archsetjmp.h <<\EOF
/*
 * arch/x86_64/include/klibc/archsetjmp.h
 */

#ifndef _KLIBC_ARCHSETJMP_H
#define _KLIBC_ARCHSETJMP_H

struct __jmp_buf {
  unsigned long __rbx;
  unsigned long __rsp;
  unsigned long __rbp;
  unsigned long __r12;
  unsigned long __r13;
  unsigned long __r14;
  unsigned long __r15;
  unsigned long __rip;
};

typedef struct __jmp_buf jmp_buf[1];

#endif /* _SETJMP_H */
EOF

cat >patch <<\EOF
diff --git a/klibc/arch/x86_64/include/klibc/archsetjmp.h b/include/arch/cris/klibc/archsetjmp.h
similarity index 76%
copy from klibc/arch/x86_64/include/klibc/archsetjmp.h
copy to include/arch/cris/klibc/archsetjmp.h
--- a/klibc/arch/x86_64/include/klibc/archsetjmp.h
+++ b/include/arch/cris/klibc/archsetjmp.h
@@ -1,21 +1,24 @@
 /*
- * arch/x86_64/include/klibc/archsetjmp.h
+ * arch/cris/include/klibc/archsetjmp.h
  */
 
 #ifndef _KLIBC_ARCHSETJMP_H
 #define _KLIBC_ARCHSETJMP_H
 
 struct __jmp_buf {
-  unsigned long __rbx;
-  unsigned long __rsp;
-  unsigned long __rbp;
-  unsigned long __r12;
-  unsigned long __r13;
-  unsigned long __r14;
-  unsigned long __r15;
-  unsigned long __rip;
+  unsigned long __r0;
+  unsigned long __r1;
+  unsigned long __r2;
+  unsigned long __r3;
+  unsigned long __r4;
+  unsigned long __r5;
+  unsigned long __r6;
+  unsigned long __r7;
+  unsigned long __r8;
+  unsigned long __sp;
+  unsigned long __srp;
 };
 
 typedef struct __jmp_buf jmp_buf[1];
 
-#endif /* _SETJMP_H */
+#endif /* _KLIBC_ARCHSETJMP_H */
diff --git a/klibc/arch/x86_64/include/klibc/archsetjmp.h b/include/arch/m32r/klibc/archsetjmp.h
similarity index 66%
rename from klibc/arch/x86_64/include/klibc/archsetjmp.h
rename to include/arch/m32r/klibc/archsetjmp.h
--- a/klibc/arch/x86_64/include/klibc/archsetjmp.h
+++ b/include/arch/m32r/klibc/archsetjmp.h
@@ -1,21 +1,21 @@
 /*
- * arch/x86_64/include/klibc/archsetjmp.h
+ * arch/m32r/include/klibc/archsetjmp.h
  */
 
 #ifndef _KLIBC_ARCHSETJMP_H
 #define _KLIBC_ARCHSETJMP_H
 
 struct __jmp_buf {
-  unsigned long __rbx;
-  unsigned long __rsp;
-  unsigned long __rbp;
+  unsigned long __r8;
+  unsigned long __r9;
+  unsigned long __r10;
+  unsigned long __r11;
   unsigned long __r12;
   unsigned long __r13;
   unsigned long __r14;
   unsigned long __r15;
-  unsigned long __rip;
 };
 
 typedef struct __jmp_buf jmp_buf[1];
 
-#endif /* _SETJMP_H */
+#endif /* _KLIBC_ARCHSETJMP_H */
EOF

find include klibc -type f -print | xargs git-update-index --add --

test_expect_success 'check rename/copy patch' 'git-apply --check patch'

test_expect_success 'apply rename/copy patch' 'git-apply --index patch'

test_done
back to top