lkml.org 
[lkml]   [2015]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 10/10] module: Rework module_addr_{min,max}
On Tue, Apr 14, 2015 at 12:25:45PM +0930, Rusty Russell wrote:
> Ingo Molnar <mingo@kernel.org> writes:
> > * Peter Zijlstra <peterz@infradead.org> wrote:
> >
> >> __module_address() does an initial bound check before doing the
> >> {list/tree} iteration to find the actual module. The bound variables
> >> are nowhere near the mod_tree cacheline, in fact they're nowhere
> >> near one another.
> >>
> >> module_addr_min lives in .data while module_addr_max lives in .bss
> >> (smarty pants GCC thinks the explicit 0 assignment is a mistake).
> >>
> >> Rectify this by moving the two variables into a structure together
> >> with the latch_tree_root to guarantee they all share the same
> >> cacheline and avoid hitting two extra cachelines for the lookup.
> >>
> >> While reworking the bounds code, move the bound update from
> >> allocation to insertion time, this avoids updating the bounds for a
> >> few error paths.
> >
> >> +static struct mod_tree_root {
> >> + struct latch_tree_root root;
> >> + unsigned long addr_min;
> >> + unsigned long addr_max;
> >> +} mod_tree __cacheline_aligned = {
> >> + .addr_min = -1UL,
> >> +};
> >> +
> >> +#define module_addr_min mod_tree.addr_min
> >> +#define module_addr_max mod_tree.addr_max
>
> Nice catch.
>
> Does the min/max comparison still win us anything? (I'm guessing yes...)

Yep, while a tree iteration is much faster than the linear thing it is
still quite a bit slower than two simple compares.

> In general, I'm happy with this series. Assume you want another
> go-round for Ingo's tweaks, then I'll take them for 4.2.

Thanks!


\
 
 \ /
  Last update: 2015-04-14 09:21    [W:0.076 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site