The patch titled

     x86: compress the stack layout of do_page_fault()

has been added to the -mm tree.  Its filename is

     x86-compress-the-stack-layout-of-do_page_fault.patch

Patches currently in -mm which might be from [EMAIL PROTECTED] are

x86-compress-the-stack-layout-of-do_page_fault.patch
detect-soft-lockups.patch
reduce-the-stack-footprint-of-pcmcia_device_query.patch
ingo-nfs-stuff.patch
spinlock-consolidation.patch
spinlock-consolidation-m32r-fix.patch
spinlock-consolidation-up-spinlocks-gcc-29x-fix.patch
kgdb-ga.patch
detect-atomic-counter-underflows.patch
sched-run-sched_normal-tasks-with-real-time-tasks-on-smt-siblings.patch
max_user_rt_prio-and-max_rt_prio-are-wrong.patch
sched-cleanups.patch
sched-task_noninteractive.patch
sched-add-cacheflush-asm.patch
scheduler-cache-hot-autodetect.patch
sched-implement-nice-support-across-physical-cpus-on-smp.patch
sched-change_prio_bias_only_if_queued.patch
sched-account_rt_tasks_in_prio_bias.patch
sched-fix-smt-scheduler-latency-bug.patch
sched-consider-migration-thread-with-smp-nice.patch
timer-initialization-cleanup-define_timer.patch
timer-initialization-cleanup-define_timer-pluto-fix.patch
more-spin_lock_unlocked-define_spinlock-conversions.patch
unexport-idle_cpu.patch



From: Ingo Molnar <[EMAIL PROTECTED]>

This patch pushes the creation of a rare signal frame (SIGBUS or SIGSEGV)
into a separate function, thus saving stackspace in the main
do_page_fault() stackframe.  The effect is 132 bytes less of stack used by
the typical do_page_fault() invocation - resulting in a denser
cache-layout.

(Another minor effect is that in case of kernel crashes that come from a
pagefault, we add less space to the already existing frame, giving the
crash functions a slightly higher chance to do their stuff without
overflowing the stack.)

(The changes also result in slightly cleaner code.)

argument bugfix from "Guillaume C." <[EMAIL PROTECTED]>

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 arch/i386/mm/fault.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff -puN arch/i386/mm/fault.c~x86-compress-the-stack-layout-of-do_page_fault 
arch/i386/mm/fault.c
--- devel/arch/i386/mm/fault.c~x86-compress-the-stack-layout-of-do_page_fault   
2005-07-09 12:08:07.000000000 -0700
+++ devel-akpm/arch/i386/mm/fault.c     2005-07-09 12:08:07.000000000 -0700
@@ -199,6 +199,18 @@ static inline int is_prefetch(struct pt_
        return 0;
 } 
 
+static void force_sig_info_fault(int si_signo, int si_code,
+                                unsigned long address, struct task_struct *tsk)
+{
+       siginfo_t info;
+
+       info.si_signo = si_signo;
+       info.si_errno = 0;
+       info.si_code = si_code;
+       info.si_addr = (void __user *)address;
+       force_sig_info(si_signo, &info, tsk);
+}
+
 fastcall void do_invalid_op(struct pt_regs *, unsigned long);
 
 /*
@@ -218,8 +230,7 @@ fastcall void do_page_fault(struct pt_re
        struct vm_area_struct * vma;
        unsigned long address;
        unsigned long page;
-       int write;
-       siginfo_t info;
+       int write, si_code;
 
        /* get the address */
        __asm__("movl %%cr2,%0":"=r" (address));
@@ -233,7 +244,7 @@ fastcall void do_page_fault(struct pt_re
 
        tsk = current;
 
-       info.si_code = SEGV_MAPERR;
+       si_code = SEGV_MAPERR;
 
        /*
         * We fault-in kernel-space virtual memory on-demand. The
@@ -313,7 +324,7 @@ fastcall void do_page_fault(struct pt_re
  * we can handle it..
  */
 good_area:
-       info.si_code = SEGV_ACCERR;
+       si_code = SEGV_ACCERR;
        write = 0;
        switch (error_code & 3) {
                default:        /* 3: write, present */
@@ -387,11 +398,7 @@ bad_area_nosemaphore:
                /* Kernel addresses are always protection faults */
                tsk->thread.error_code = error_code | (address >= TASK_SIZE);
                tsk->thread.trap_no = 14;
-               info.si_signo = SIGSEGV;
-               info.si_errno = 0;
-               /* info.si_code has been set above */
-               info.si_addr = (void __user *)address;
-               force_sig_info(SIGSEGV, &info, tsk);
+               force_sig_info_fault(SIGSEGV, si_code, address, tsk);
                return;
        }
 
@@ -506,11 +513,7 @@ do_sigbus:
        tsk->thread.cr2 = address;
        tsk->thread.error_code = error_code;
        tsk->thread.trap_no = 14;
-       info.si_signo = SIGBUS;
-       info.si_errno = 0;
-       info.si_code = BUS_ADRERR;
-       info.si_addr = (void __user *)address;
-       force_sig_info(SIGBUS, &info, tsk);
+       force_sig_info_fault(SIGBUS, BUS_ADRERR, address, tsk);
        return;
 
 vmalloc_fault:
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to