Re: Optimizing notifier_call_chain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 22 Nov 2005, Chandra Seetharaman wrote:

> Hello,
> 
> While making the notifier chain safe, i found room for some optimization.
> Please comment on if it is worth pursuing.
> 
> notifier_call_chain() calls registered callouts for _all_ events. But, many
> of the callouts handle only few events.
> 
> If we change notifier_call_chain() to call the callout only on registered
> events, we can avoid few function overhead.
> 
> Currently, events is of free format, we have to make it bit per event.
> Among the existing users, ia64die_chain uses the highest number(25) of 
> events. i think 64 bit event would suffice.
> 
> simplified logic:
> 	notifier_call_chain(event) 
> 	{
> 		if ((head->event & event) != 0)
> 			return;
> 		for_each_callout {
> 			if ((notifier_block->event & event) != 0)
> 				notifier_block->call(event);
> 		}
> 	}

You would need to mask against (1ull << event), not against event.  
tset_bit() might work better.

Do you really want to do this?  It will mean changing every single 
notifier_block definition in the kernel, in addition to all the the 
notifier_heads.  That's an awful lot of work for a relatively small gain.  
I believe that notifier_call_chain does not run very often, but I don't 
have any actual figures.

Alan Stern

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux