* make memclass() an inline functino
@ 2002-06-02 23:33 William Lee Irwin III
2002-06-03 1:09 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: William Lee Irwin III @ 2002-06-02 23:33 UTC (permalink / raw)
To: linux-kernel; +Cc: trivial
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
+++ edited/include/linux/mmzone.h Sun Jun 2 16:32:35 2002
@@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: make memclass() an inline functino
2002-06-02 23:33 make memclass() an inline functino William Lee Irwin III
@ 2002-06-03 1:09 ` Alan Cox
2002-06-03 5:08 ` William Lee Irwin III
0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2002-06-03 1:09 UTC (permalink / raw)
To: William Lee Irwin III; +Cc: linux-kernel, trivial
On Mon, 2002-06-03 at 00:33, William Lee Irwin III wrote:
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: make memclass() an inline functino
2002-06-03 1:09 ` Alan Cox
@ 2002-06-03 5:08 ` William Lee Irwin III
0 siblings, 0 replies; 3+ messages in thread
From: William Lee Irwin III @ 2002-06-03 5:08 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-kernel, trivial
On Mon, 2002-06-03 at 00:33, William Lee Irwin III wrote:
>> 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.
On Mon, Jun 03, 2002 at 02:09:21AM +0100, Alan Cox wrote:
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-06-03 5:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-02 23:33 make memclass() an inline functino William Lee Irwin III
2002-06-03 1:09 ` Alan Cox
2002-06-03 5:08 ` William Lee Irwin III
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox