Re: swapctl: SWAP_STATS different to SWAP_NSWAP (2 != 3)

[email protected] (Michael van Elst)
Newsgroups gmane.os.netbsd.current
Organization Serpens User Group
Message-ID <[email protected]>
[email protected] (Thomas Klausner) writes:

>On Thu, Feb 12, 2026 at 06:14:41PM +0100, Matthew Green wrote:
>> > Hi!
>> >
>> > While trying to take a closer look at https://gnats.netbsd.org/56764
>> > I'm keeping 'swapctl -l; sleep 1' running in a loop next to a bulk
>> > build.
>> 
>> can you see if -current no longer has this problem?  i think i saw
>> what was wrong that would trigger this problem and commited a fix.

>I think that might have made it worse:

>#11 uvm_fault_internal (orig_map=orig_map@entry=0xffff9cd8c58d5ac0, vaddr=vaddr@entry=126083539185664, access_type=access_type@entry=2, fault_flag=fault_flag@entry=0) at /usr/src/sys/uvm/uvm_fault.c:946
>#12 0xffffffff8023c5d4 in trap (frame=0xffffa7a493785870) at /usr/src/sys/arch/amd64/amd64/trap.c:523
>#13 0xffffffff80234ad4 in alltraps ()
>#14 0xffffffff80234353 in copyout ()
>#15 0xffffffff80ddf279 in uvm_swap_stats (ptr=0x72ac1c90b000 <error: Cannot access memory at address 0x72ac1c90b000>, misc=2, f=f@entry=0x0, len=len@entry=1056, retval=retval@entry=0xffffa7a493785fb0)
>    at /usr/src/sys/uvm/uvm_swap.c:818


Holding a lock while running copyout that page-faults can be a problem.

Since the list is only rotated, it's sufficient to collect pointers
to the entries into a kernel buffer. After releasing the data
lock, the entries can then be copied out.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.