make memclass() an inline functino
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 =====
include/linux/mmzone.h +8 -2
@@ -142,8 +142,14 @@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
Quoted 4 lines · William Lee Irwin III
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
Quoted 3 lines · William Lee Irwin III
Quoted 3 lines
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 convertmemclass()to be an inline function.
Quoted 2 lines · Alan Cox
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