proc: fix kflags to uflags copying in /proc/kpageflags
PATCH 1/1 proc: fix kflags to uflags copying in /proc/kpageflags
Fix kpf_copy_bit(src,dst) to be kpf_copy_bit(dst,src) to match the actual call patterns, e.g. kpf_copy_bit(kflags, KPF_LOCKED, PG_locked).
This misplacement of src/dst only affected reporting of PG_writeback, PG_reclaim and PG_buddy. For others kflags==uflags so not affected.
---
This is a tested and trivial no-side-effect fix. I'd suggest it for 2.6.29-rc7 and 2.6.28.X kernels.
fs/proc/page.c +1 -1
@@ -80,7 +80,7 @@ static const struct file_operations proc_kpagecount_operations = {#define KPF_RECLAIM 9#define KPF_BUDDY 10 -#define kpf_copy_bit (flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos) +#define kpf_copy_bit (flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos)static ssize_t kpageflags_read (struct file *file,char __user *buf,size_t count,loff_t *ppos)
Quoted 17 lines
Fix
kpf_copy_bit(src,dst)to bekpf_copy_bit(dst,src)to match the actual call patterns, e.g.kpf_copy_bit(kflags, KPF_LOCKED, PG_locked).This misplacement of src/dst only affected reporting of
PG_writeback,PG_reclaimandPG_buddy. For others kflags==uflags so not affected.Signed-off-by Wu Fengguang <[email protected]>---
This is a tested and trivial no-side-effect fix. I'd suggest it for 2.6.29-rc7 and 2.6.28.X kernels.
fs/proc/page.c +0
-0
fs/proc/page.c static const struct file_operations proc_kpagecount_operations = { · line 83
Quoted 5 lines
fs/proc/page.c +1
-1@@ -80,7 +80,7 @@ static const struct file_operations proc_kpagecount_operations = {#define KPF_RECLAIM 9#define KPF_BUDDY 10 -#define kpf_copy_bit (flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos) +#define kpf_copy_bit (flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos)
Good catch! :)
but don't worry. the number of this interface user is very few.
Quoted 20 lines · KOSAKI Motohiro
Quoted 20 lines
Fix
kpf_copy_bit(src,dst)to bekpf_copy_bit(dst,src)to match the actual call patterns, e.g.kpf_copy_bit(kflags, KPF_LOCKED, PG_locked).This misplacement of src/dst only affected reporting of
PG_writeback,PG_reclaimandPG_buddy. For others kflags==uflags so not affected.Signed-off-by Wu Fengguang <[email protected]>---
This is a tested and trivial no-side-effect fix. I'd suggest it for 2.6.29-rc7 and 2.6.28.X kernels.
fs/proc/page.c +0
-0@@ -80,7 +80,7 @@ static const struct file_operations proc_kpagecount_operations = {#define KPF_RECLAIM 9#define KPF_BUDDY 10
Quoted 5 lines
fs/proc/page.c static const struct file_operations proc_kpagecount_operations = { · line 83
Quoted 2 lines
fs/proc/page.c +1
-1-#define kpf_copy_bit (flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos) +#define kpf_copy_bit (flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos)Good catch! :)
Reviewed-by KOSAKI Motohiro <[email protected]>
Thank you :)
Quoted 2 lines
but don't worry. the number of this interface user is very few.
Yeah, so few users that I have to write the tools by myself ;-)
Thanks,
Fengguang