Re: [PATCH 1/3] Reduce get_current() to the asm-generic implementation where possible

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

 



On Tue, May 18, 2010 at 08:47:53PM +0100, Jamie Lokier wrote:
> David Howells wrote:
> > Reduce get_current() to the asm-generic implementation where
> > possible to remove duplicate cases.
> > 
> > Note that this will lose the const attribute on get_current() for ARM and
> > MN10300.  This will be added back in a later patch for all architectures.
> [...]
> > -static inline struct task_struct *get_current(void) __attribute_const__;
> > -
> > -static inline struct task_struct *get_current(void)
> > -{
> > -	return current_thread_info()->task;
> > -}
> 
> 
> Last time I looked, GCC didn't seem to do anything useful with the
> const attribute on inline functions.  I.e. no elimination of duplicate calls.

Probably child functions should be marked const as well.

 
> (It does eliminate them when out-of-line.)
> 
> So there is probably no point putting the const attribute back, unless
> GCC has changed at this.
> 
> It might be able to eliminate some duplicates if the asm inside
> current_thread_info() is consty enough, and duplicate ->task
> dereferences might be eliminated by strict-aliasing in some cases.

I don't think it hurts to give more information even if the compiler
does not use it yet.
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux