From owner-svn-src-stable@freebsd.org Fri Jan 5 11:45:41 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 66C0CEC5D1B; Fri, 5 Jan 2018 11:45:41 +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 3E6CE643FD; Fri, 5 Jan 2018 11:45:41 +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 w05BjeDm048171; Fri, 5 Jan 2018 11:45:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w05Bjeio048170; Fri, 5 Jan 2018 11:45:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201801051145.w05Bjeio048170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 5 Jan 2018 11:45:40 +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: r327586 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 327586 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: Fri, 05 Jan 2018 11:45:41 -0000 Author: kib Date: Fri Jan 5 11:45:40 2018 New Revision: 327586 URL: https://svnweb.freebsd.org/changeset/base/327586 Log: MFC r327354: Style. Modified: stable/11/sys/vm/vm_swapout.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_swapout.c ============================================================================== --- stable/11/sys/vm/vm_swapout.c Fri Jan 5 10:04:13 2018 (r327585) +++ stable/11/sys/vm/vm_swapout.c Fri Jan 5 11:45:40 2018 (r327586) @@ -554,16 +554,14 @@ vm_thread_swapin(struct thread *td) { vm_object_t ksobj; vm_page_t ma[KSTACK_MAX_PAGES]; - int pages; + int a, count, i, j, pages, rv; pages = td->td_kstack_pages; ksobj = td->td_kstack_obj; VM_OBJECT_WLOCK(ksobj); (void)vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, ma, pages); - for (int i = 0; i < pages;) { - int j, a, count, rv; - + for (i = 0; i < pages;) { vm_page_assert_xbusied(ma[i]); if (ma[i]->valid == VM_PAGE_BITS_ALL) { vm_page_xunbusy(ma[i]); @@ -640,13 +638,9 @@ faultin(struct proc *p) void swapper(void) { - struct proc *p; + struct proc *p, *pp; struct thread *td; - struct proc *pp; - int slptime; - int swtime; - int ppri; - int pri; + int ppri, pri, slptime, swtime; loop: if (vm_page_count_min()) { @@ -733,15 +727,15 @@ swapout_procs(int action) { struct proc *p; struct thread *td; - int didswap = 0; + struct vmspace *vm; + int minslptime, slptime; + bool didswap; + minslptime = 100000; + didswap = false; retry: sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { - struct vmspace *vm; - int minslptime = 100000; - int slptime; - PROC_LOCK(p); /* * Watch out for a process in @@ -791,17 +785,20 @@ retry: goto nextproc; /* - * only aiod changes vmspace, however it will be + * Only aiod changes vmspace. However, it will be * skipped because of the if statement above checking - * for P_SYSTEM + * for P_SYSTEM. */ - if ((p->p_flag & (P_INMEM|P_SWAPPINGOUT|P_SWAPPINGIN)) != P_INMEM) + if ((p->p_flag & (P_INMEM | P_SWAPPINGOUT | P_SWAPPINGIN)) != + P_INMEM) goto nextproc; switch (p->p_state) { default: - /* Don't swap out processes in any sort - * of 'special' state. */ + /* + * Don't swap out processes in any sort + * of 'special' state. + */ break; case PRS_NORMAL: @@ -844,9 +841,9 @@ retry: * idle processes >= swap_idle_threshold2, * then swap the process out. */ - if (((action & VM_SWAP_NORMAL) == 0) && - (((action & VM_SWAP_IDLE) == 0) || - (slptime < swap_idle_threshold2))) { + if ((action & VM_SWAP_NORMAL) == 0 && + ((action & VM_SWAP_IDLE) == 0 || + slptime < swap_idle_threshold2)) { thread_unlock(td); goto nextproc; } @@ -861,12 +858,12 @@ retry: * or if this process is idle and the system is * configured to swap proactively, swap it out. */ - if ((action & VM_SWAP_NORMAL) || - ((action & VM_SWAP_IDLE) && - (minslptime > swap_idle_threshold2))) { + if ((action & VM_SWAP_NORMAL) != 0 || + ((action & VM_SWAP_IDLE) != 0 && + minslptime > swap_idle_threshold2)) { _PRELE(p); if (swapout(p) == 0) - didswap++; + didswap = true; PROC_UNLOCK(p); vm_map_unlock(&vm->vm_map); vmspace_free(vm); @@ -936,9 +933,10 @@ swapout(struct proc *p) P_INMEM, ("swapout: lost a swapout race?")); /* - * remember the process resident count + * Remember the resident count. */ p->p_vmspace->vm_swrss = vmspace_resident_count(p->p_vmspace); + /* * Check and mark all threads before we proceed. */