Subject: kern/26597: LKM - page size abuse
To: None <>
From: Peter Postma <>
List: netbsd-bugs
Date: 08/08/2004 20:34:41
>Number:         26597
>Category:       kern
>Synopsis:       LKM - page size abuse
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 08 19:01:00 UTC 2004
>Originator:     Peter Postma
>Release:        NetBSD 2.0G
System: NetBSD 2.0G NetBSD 2.0G (mercury) #46: Sun Aug 8 18:20:53 CEST 2004 sparc64
Architecture: sparc64
Machine: sparc64
While reading the LKM code (sys/kern/kern_lkm.c), I saw this:

line 90: #define PAGESIZE 1024		/* kmem_alloc() allocation quantum */

line 575: statp->size	= curp->size / PAGESIZE;

This can't be right to redefine the page size with another value
(page size is 8192 on sparc64) and use that in the stats.

Read the code.

Remove "#define PAGESIZE" and replace PAGESIZE at line 575 with "PAGE_SIZE".