From owner-freebsd-hackers@freebsd.org Thu Sep 19 21:24:56 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DC3A12EFE8 for ; Thu, 19 Sep 2019 21:24:56 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from mail03.asahi-net.or.jp (mail03.asahi-net.or.jp [202.224.55.15]) by mx1.freebsd.org (Postfix) with ESMTP id 46Z8xx3m3Zz4JfT for ; Thu, 19 Sep 2019 21:24:52 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from rv515.advok.com (pool-72-76-119-135.nwrknj.fios.verizon.net [72.76.119.135]) (Authenticated sender: NR2Y-OOT) by mail03.asahi-net.or.jp (Postfix) with ESMTPSA id E0E8668B9D; Fri, 20 Sep 2019 06:24:47 +0900 (JST) Date: Thu, 19 Sep 2019 17:23:53 -0400 From: Yoshihiro Ota To: Konstantin Belousov Cc: freebsd-hackers@freebsd.org Subject: Re: How to access user process memory/pages from swap_pager.c Message-Id: <20190919172353.2da06fc2aec3a332e2462ada@j.email.ne.jp> In-Reply-To: <20190919061216.GG2559@kib.kiev.ua> References: <20190919003419.007b6de7f9887617f254e334@j.email.ne.jp> <20190919061216.GG2559@kib.kiev.ua> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; i386-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46Z8xx3m3Zz4JfT X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ota@j.email.ne.jp designates 202.224.55.15 as permitted sender) smtp.mailfrom=ota@j.email.ne.jp X-Spamd-Result: default: False [0.49 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:202.224.55.0/24]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[email.ne.jp]; NEURAL_HAM_LONG(-0.85)[-0.851,0]; NEURAL_SPAM_MEDIUM(0.18)[0.179,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; IP_SCORE(0.96)[ip: (0.68), ipnet: 202.224.32.0/19(0.21), asn: 4685(3.94), country: JP(-0.02)]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[15.55.224.202.list.dnswl.org : 127.0.5.1]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:4685, ipnet:202.224.32.0/19, country:JP]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[135.119.76.72.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Sep 2019 21:24:56 -0000 On Thu, 19 Sep 2019 09:12:16 +0300 Konstantin Belousov wrote: > On Thu, Sep 19, 2019 at 12:34:19AM -0400, Yoshihiro Ota wrote: > > Hi, > > > > I'm trying to get some data / statistics for pages being swapped out. > > > > I'm trying to access pages being swapped out in swp_pager_putpages. > > Given I have access to vm_page_t, it looked like I would be able to use VM_PAGE_TO_PHYS() to > > access user pages. > > > > However, I get page-fault panics like: > > panic: vm_fault_hold: fault on nofault entry, addr: 0 > > > > Which functions/setup do I need to access/copy user data being swapped? > > I am not sure what you are trying to do, but whatever is it, it is > unreasonable. > > When a page is swapped out, its physical memory frame, described by > vm_page_t, is reused for something else. The only resource consumed by > swapped out page is the index in the vm_object page queue, swap space > which holds the actual content, and pointer from swap pager data to the > swap location. I'm trying before pageout I/O are scheduled at https://svnweb.freebsd.org/base/head/sys/vm/swap_pager.c?revision=352407&view=markup#l1373 This is where it is about to start looking for available swap spaces in swap devices. Hiro