From owner-svn-src-head@freebsd.org Sun Jun 28 21:34:39 2020 Return-Path: Delivered-To: svn-src-head@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 E432E3566C8; Sun, 28 Jun 2020 21:34:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49w3mb5mN4z3dbw; Sun, 28 Jun 2020 21:34:39 +0000 (UTC) (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F0F81C8CF; Sun, 28 Jun 2020 21:34:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05SLYdCP040143; Sun, 28 Jun 2020 21:34:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SLYdfL040142; Sun, 28 Jun 2020 21:34:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006282134.05SLYdfL040142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 28 Jun 2020 21:34:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362739 - in head/sys: compat/linuxkpi/common/src dev/md X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/src dev/md X-SVN-Commit-Revision: 362739 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2020 21:34:40 -0000 Author: markj Date: Sun Jun 28 21:34:38 2020 New Revision: 362739 URL: https://svnweb.freebsd.org/changeset/base/362739 Log: Remove some redundant assignments and computations. Reported by: alc Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25400 Modified: head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/dev/md/md.c Modified: head/sys/compat/linuxkpi/common/src/linux_page.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_page.c Sun Jun 28 21:33:08 2020 (r362738) +++ head/sys/compat/linuxkpi/common/src/linux_page.c Sun Jun 28 21:34:38 2020 (r362739) @@ -199,7 +199,7 @@ linux_get_user_pages_internal(vm_map_t map, unsigned l int count; prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; - len = ((size_t)nr_pages) << PAGE_SHIFT; + len = ptoa((vm_offset_t)nr_pages); count = vm_fault_quick_hold_pages(map, start, len, prot, pages, nr_pages); return (count == -1 ? -EFAULT : nr_pages); } @@ -219,9 +219,8 @@ __get_user_pages_fast(unsigned long start, int nr_page return (0); MPASS(pages != NULL); - va = start; map = &curthread->td_proc->p_vmspace->vm_map; - end = start + (((size_t)nr_pages) << PAGE_SHIFT); + end = start + ptoa((vm_offset_t)nr_pages); if (!vm_map_range_valid(map, start, end)) return (-EINVAL); prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Sun Jun 28 21:33:08 2020 (r362738) +++ head/sys/dev/md/md.c Sun Jun 28 21:34:38 2020 (r362739) @@ -1561,8 +1561,8 @@ mdresize(struct md_s *sc, struct md_req *mdr) if (mdr->md_mediasize <= 0 || (mdr->md_mediasize % PAGE_SIZE) != 0) return (EDOM); - oldpages = OFF_TO_IDX(round_page(sc->mediasize)); - newpages = OFF_TO_IDX(round_page(mdr->md_mediasize)); + oldpages = OFF_TO_IDX(sc->mediasize); + newpages = OFF_TO_IDX(mdr->md_mediasize); if (newpages < oldpages) { VM_OBJECT_WLOCK(sc->object); vm_object_page_remove(sc->object, newpages, 0, 0);