lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1304646103.3131.3.camel@edumazet-laptop>
Date:	Fri, 06 May 2011 03:41:43 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	john stultz <johnstul@...ibm.com>,
	lkml <linux-kernel@...r.kernel.org>,
	Paul Mackerras <paulus@...ba.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Anton Blanchard <anton@...ba.org>, Ingo Molnar <mingo@...e.hu>
Subject: Re: [RFC] time: xtime_lock is held too long

Le jeudi 05 mai 2011 à 23:01 +0200, Andi Kleen a écrit :
> > > Another idea would be to prime cache lines to be dirtied in cpu cache
> > > before taking locks, and better pack variables to reduce number of cache
> > > lines.
> > 
> > Most variables are packed already in struct timekeeper, which should
> > be pretty cache hot anyway, so I don't know whether we gain much.
> 
> There's actually some potential here. I got a moderate speedup in a
> database benchmark with this patch recently. The biggest win
> was in the timer interrupt.
> 
> All those variables are on separate cache lines.
> 
> (needs some cleanups, just for illustration)
> 
> -Andi
> 
> From: Andi Kleen <ak@...ux.intel.com>
> Subject: [PATCH] do prefetches for timer state in timer interrupt
> 
> diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
> index 76b96d7..2704267 100644
> --- a/arch/x86/kernel/apic/apic.c
> +++ b/arch/x86/kernel/apic/apic.c
> @@ -856,6 +856,17 @@ void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
>  {
>  	struct pt_regs *old_regs = set_irq_regs(regs);
>  
> +	extern struct timespec xtime;
> +	extern struct timespec wall_to_monotonic;
> +
> +
> +	/* Prefetch here to make the ktime_get later faster.
> + 	 * XXX move them all on the same cache line.
> + 	 */
> +	prefetch(&xtime_lock);
> +	prefetch(&xtime);
> +	prefetch(&wall_to_monotonic);
> +
>  	/*
>  	 * NOTE! We'd better ACK the irq immediately,
>  	 * because timer handling can be slow.
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index d27c756..0002e9e 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -157,8 +157,8 @@ __cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
>   * - wall_to_monotonic is no longer the boot time, getboottime must be
>   * used instead.
>   */
> -static struct timespec xtime __attribute__ ((aligned (16)));
> -static struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
> +struct timespec xtime __attribute__ ((aligned (16)));
> +struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
>  static struct timespec total_sleep_time;
>  
>  /*
> 


Did you tried prefetchw() by any chance ?



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ