make memclass() an inline functino

make memclass() an inline functino

Post by William Lee Irwin II » Tue, 04 Jun 2002 08:40:10



memclass is too large to be a #define; it overflows 80 columns and does
not make use of facilities available only to macros.

This patch convert memclass() to be an inline function.

Cheers,
Bill

===== include/linux/mmzone.h 1.10 vs edited =====
--- 1.10/include/linux/mmzone.h Sat May 25 16:25:47 2002

 extern int numnodes;
 extern pg_data_t *pgdat_list;

-#define memclass(pgzone, classzone)    (((pgzone)->zone_pgdat == (classzone)->zone_pgdat) \
-                       && ((pgzone) <= (classzone)))
+static inline int memclass(zone_t *pgzone, zone_t *classzone)
+{
+       if (pgzone->zone_pgdat != classzone->zone_pgdat)
+               return 0;
+       if (pgzone > classzone)
+               return 0;
+       return 1;
+}

 /*
  * The following two are not meant for general usage. They are here as
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

make memclass() an inline functino

Post by Alan Co » Tue, 04 Jun 2002 09:10:07



Quote:> memclass is too large to be a #define; it overflows 80 columns and does
> not make use of facilities available only to macros.

> This patch convert memclass() to be an inline function.

Exercise care when doing this. Gcc sometimes optimises macros better
than it optimises inline functions

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

make memclass() an inline functino

Post by William Lee Irwin II » Tue, 04 Jun 2002 14:20:04



>> memclass is too large to be a #define; it overflows 80 columns and does
>> not make use of facilities available only to macros.
>> This patch convert memclass() to be an inline function.

> Exercise care when doing this. Gcc sometimes optimises macros better
> than it optimises inline functions

I'll go over the assembly generated for i386, though I'm not entirely
convinced this is exercised in the fast path.

Cheers,
Bill
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. "extern inline" to "static inline" allows compile

Hi,

I can't compile 2.5.51 on an EV56 without this. Tested, boots.
There are a bunch of symbols in core_cia.h that break the build if they're
extern inline because they're only defined in the header now. Make them
static inline instead. (Important, since they're #defined to things like
inb)

Comments?

Matt

diff -Nru a/include/asm-alpha/core_cia.h b/include/asm-alpha/core_cia.h
--- a/include/asm-alpha/core_cia.h      Thu Dec 12 16:59:06 2002

 #ifdef __KERNEL__

 #ifndef __EXTERN_INLINE
-#define __EXTERN_INLINE extern inline
+#define __EXTERN_INLINE static inline
 #define __IO_EXTERN_INLINE
 #endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. Paper format

3. static inline, and extern inline in the kernel source

4. src.rpm ... HOW-TO ??

5. why is "static inline" preferred over "extern inline"?

6. Linux + DNS - forwarding requests?

7. cscope not seeing my functinos

8. Static Binaries Uploaded to Sunsite.

9. Making changes to env variables and making them stick

10. Making a new kernel - CVSuped, not made world yet.

11. Netscape and inline images

12. not inline code in kernel (reducing kernel size)

13. GCC's inline assembler, and it's apparent lack of knowledge