Re: const from include/asm-i386/byteorder.h

From: Nikita Danilov (Nikita@Namesys.COM)
Date: Mon Jun 02 2003 - 07:36:18 EST


William Lee Irwin III writes:
> On Mon, Jun 02, 2003 at 03:51:39PM +0400, Nikita Danilov wrote:
> > Gcc info page:
> > `const'
> > Many functions do not examine any values except their arguments,
> > and have no effects except the return value. Basically this is
> > just slightly more strict class than the `pure' attribute above,
> > since function is not allowed to read global memory.
> > So, it seems byte swapping functions should be __attribute__((const))
> > Here is a patch:
>
> I'm very skeptical, in particular, about these hunks:
>
>
> On Mon, Jun 02, 2003 at 03:51:39PM +0400, Nikita Danilov wrote:
> > #include <linux/thread_info.h>
> > -static inline struct task_struct *get_current(void) __attribute__ (( __const__ ));
> > +static inline struct task_struct *get_current(void) __attribute_const;
> > static inline struct task_struct *get_current(void)
> > {
> > ===== include/asm-arm/thread_info.h 1.6 vs edited =====
> > --- 1.6/include/asm-arm/thread_info.h Sat Dec 28 19:26:45 2002
> > +++ edited/include/asm-arm/thread_info.h Mon Jun 2 14:44:24 2003
> > @@ -74,7 +74,7 @@
> > /*
> > * how to get the thread information struct from C
> > */
> > -static inline struct thread_info *current_thread_info(void) __attribute__ (( __const__ ));
> > +static inline struct thread_info *current_thread_info(void) __attribute_const;
> >
> > static inline struct thread_info *current_thread_info(void)
> > {
>
> Someone needs to doublecheck whether this actually works. Last I heard,

I don't quite understand. __attribute_const is defined as

#define __attribute_const __attribute__ ((__const__))

so, after preprocessing prototypes of get_current() and
current_thread_info() will be the same as before patch, modulo spacing.

> it did not, but that could have changed since. It vaguely appears some
> assumption about it working was made recently since __const__ was there.
>

I am currently running ./fsstress -p 111 on patched kernel on 2*XEON
2.20GHz with hyper threading.

>
> -- wli

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



This archive was generated by hypermail 2b29 : Sat Jun 07 2003 - 22:00:16 EST