From owner-svn-src-stable@freebsd.org Thu Jan 4 11:49:34 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65502EACEB7; Thu, 4 Jan 2018 11:49:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D2F1656A2; Thu, 4 Jan 2018 11:49:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w04BnX0t038388; Thu, 4 Jan 2018 11:49:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w04BnXCJ038386; Thu, 4 Jan 2018 11:49:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801041149.w04BnXCJ038386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 4 Jan 2018 11:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327547 - in stable/11/sys: kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: kern sys X-SVN-Commit-Revision: 327547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jan 2018 11:49:34 -0000 Author: kib Date: Thu Jan 4 11:49:32 2018 New Revision: 327547 URL: https://svnweb.freebsd.org/changeset/base/327547 Log: MFC r327285: Make kern_proc_vmmap_resident() externally accesible, and move the vmmap_skip_res_cnt control check inside it. Modified: stable/11/sys/kern/kern_proc.c stable/11/sys/sys/proc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_proc.c ============================================================================== --- stable/11/sys/kern/kern_proc.c Thu Jan 4 11:44:58 2018 (r327546) +++ stable/11/sys/kern/kern_proc.c Thu Jan 4 11:49:32 2018 (r327547) @@ -2256,9 +2256,9 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_ARGS) CTASSERT(sizeof(struct kinfo_vmentry) == KINFO_VMENTRY_SIZE); #endif -static void +void kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t entry, - struct kinfo_vmentry *kve) + int *resident_count, bool *super) { vm_object_t obj, tobj; vm_page_t m, m_adv; @@ -2266,6 +2266,11 @@ kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t vm_paddr_t locked_pa; vm_pindex_t pi, pi_adv, pindex; + *super = false; + *resident_count = 0; + if (vmmap_skip_res_cnt) + return; + locked_pa = 0; obj = entry->object.vm_object; addr = entry->start; @@ -2298,7 +2303,7 @@ kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t (addr & (pagesizes[1] - 1)) == 0 && (pmap_mincore(map->pmap, addr, &locked_pa) & MINCORE_SUPER) != 0) { - kve->kve_flags |= KVME_FLAG_SUPER; + *super = true; pi_adv = atop(pagesizes[1]); } else { /* @@ -2310,7 +2315,7 @@ kern_proc_vmmap_resident(vm_map_t map, vm_map_entry_t */ pi_adv = 1; } - kve->kve_resident += pi_adv; + *resident_count += pi_adv; next:; } PA_UNLOCK_COND(locked_pa); @@ -2334,6 +2339,7 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, s vm_offset_t addr; unsigned int last_timestamp; int error; + bool super; PROC_LOCK_ASSERT(p, MA_OWNED); @@ -2366,8 +2372,10 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, s if (obj->backing_object == NULL) kve->kve_private_resident = obj->resident_page_count; - if (!vmmap_skip_res_cnt) - kern_proc_vmmap_resident(map, entry, kve); + kern_proc_vmmap_resident(map, entry, + &kve->kve_resident, &super); + if (super) + kve->kve_flags |= KVME_FLAG_SUPER; for (tobj = obj; tobj != NULL; tobj = tobj->backing_object) { if (tobj != obj && tobj != lobj) @@ -3077,6 +3085,7 @@ resume_all_proc(void) cp = curproc; sx_xlock(&allproc_lock); +again: LIST_REMOVE(cp, p_list); LIST_INSERT_HEAD(&allproc, cp, p_list); for (;;) { @@ -3096,6 +3105,12 @@ resume_all_proc(void) } else { PROC_UNLOCK(p); } + } + /* Did the loop above missed any stopped process ? */ + LIST_FOREACH(p, &allproc, p_list) { + /* No need for proc lock. */ + if ((p->p_flag & P_TOTAL_STOP) != 0) + goto again; } sx_xunlock(&allproc_lock); } Modified: stable/11/sys/sys/proc.h ============================================================================== --- stable/11/sys/sys/proc.h Thu Jan 4 11:44:58 2018 (r327546) +++ stable/11/sys/sys/proc.h Thu Jan 4 11:49:32 2018 (r327547) @@ -182,6 +182,8 @@ struct td_sched; struct thread; struct trapframe; struct turnstile; +struct vm_map; +struct vm_map_entry; /* * XXX: Does this belong in resource.h or resourcevar.h instead? @@ -1002,6 +1004,8 @@ void fork_exit(void (*)(void *, struct trapframe *), v struct trapframe *); void fork_return(struct thread *, struct trapframe *); int inferior(struct proc *p); +void kern_proc_vmmap_resident(struct vm_map *map, struct vm_map_entry *entry, + int *resident_count, bool *super); void kern_yield(int); void kick_proc0(void); void killjobc(void);