Skip to contentSkip to conversation

current_is_kswapd is a function

PATCH William Lee Irwin III 3 participants 3 messages Oct 12, 2003 VFS

lore
Share & tools
lore
#0 lore raw

current_is_kswapd() is a function, not an integer; this explains some anomalies in reported statistics.

===== fs/inode.c 1.107 vs edited =====

fs/inode.c +1 -1
@@ -453,7 +453,7 @@
 	dispose_list(&freeable);
 	up(&iprune_sem);
 
-	if (current_is_kswapd)
+	if (current_is_kswapd())
 		mod_page_state(kswapd_inodesteal, reap);
 	else
 		mod_page_state(pginodesteal, reap);
#1 lore raw

Review

Quoted 3 lines · William Lee Irwin III
(quoted diff) +0 -1
-	if (current_is_kswapd)
 +	if (current_is_kswapd())

Well damn, I must have looked at that a hundred times when wondering why /proc/vmstat:pginodesteal was always zero. Thanks.

It would probably be worthwhile teaching the compiler to generate a warning in this case; I doubt if anyone is likely to want to find out at runtime whether the linker happened to place a particular function at address zero. I shall suggest that.

#2 lore raw
Quoted 4 lines · Andrew Morton

It would probably be worthwhile teaching the compiler to generate a warning in this case; I doubt if anyone is likely to want to find out at runtime whether the linker happened to place a particular function at address zero. I shall suggest that.

I agree it would be a very useful warning.

Testing the address is useful occasionally, to ask whether the target of a weak linkage reference was linked in, so a syntax is needed to suppress the warning, such as "&function != 0".

-- Jamie