From owner-svn-src-all@freebsd.org Thu Mar 22 21:25:34 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 484DBF6D99E; Thu, 22 Mar 2018 21:25:34 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com [IPv6:2a00:1450:4010:c07::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8BE746C98D; Thu, 22 Mar 2018 21:25:33 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x22a.google.com with SMTP id m16-v6so11588686lfc.4; Thu, 22 Mar 2018 14:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=eQFfyfBmXT6GMMChB+lKHDRFEjtCO7+BSCfjUGT11gQ=; b=dCTFzcYAWBlh5KFSliE6F/kmzRf+zl+Ez+vwf28Bj+6ylk9PM8wPoQ5Oj8+c4TI5g4 PNvkQpZC0ftM7u+s4YgdPV6ntrbAu/xCK/4gEFmWD/S6tJ3PaBa8ISXReRE2kag6N/OH fXEJibi8KstFbY5pq6fh1C8oir9BeI2PaQEe6G8jk3zCi4kDkaUYw/pVVFwPbJuDsq8r pBSPpjQ/esVHVoIK+DdmKJmDpDRsnqkBXedfawK3OLlDpvJ2+SfbC2VWdrH9GfuXrVnF C4YFceDiQK4hQzwa0LweouvIm+dcaMkXAphoWmiK/RJi+MCGht54KVhYbS1krClr4Jg6 CEKA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=eQFfyfBmXT6GMMChB+lKHDRFEjtCO7+BSCfjUGT11gQ=; b=QAP89QRxSV0FaJw2PMVT7n3reDkNNBHFtppCrsc9KRX/Ryumc8NKV5O3+fV2iyXfL2 nGfrr5texE3pxa91xuAmZK5UO7dfg3ny8KwN0HoS5p/zZLEgsBZxJP/O6sOqne2AWXEY OyyIVpDX1Qw41Q3LpUpcva3h4ouo6rf36XHRJ+bxPePqzkomqswhXV94YQqmzgnbShrm itFDb+3mg8HtBqMbXpdApqCw2rc2BY1D3WA00eNZSpuHfqVeamyTZCMXEZXdKqYzgomz g5Wy2n80m0reBtsPo13LURxEPfwDBRiGAhVC/fmi+9s4RKld3dvyRkSPVxkYOHZhLZMl gIOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=eQFfyfBmXT6GMMChB+lKHDRFEjtCO7+BSCfjUGT11gQ=; b=Tcdk5O0rPMMcCsRMcjfn+et9AmOsNdhX3OTStUZEqXszPbTUG+MWNgznsjDd2LkEri 8eC5/s5W6VoHVifknHAd1uYXd/hSh4l0+SSvVKTjuh+U6bMxhZ2+vjhzp5AYLRa0aIDr PB1Rs8s4Lo6149eeCuzdHnFSU1DI/OuguOpUz6Wbn71c//Fd5xtzZ4ZE1Xm2r6ZSPSF7 DJEWroj3JggAEPi8cXM8OHoGiRhQe/8DhCsBGNk4olvM1yA8KXJz++vCCLci6W040Unl YfbxLE6LKvMlGgRrRYSvmPn78+1TSNUZU68Lz6yc+zjvElQKg3GAkpfz5VtLfa5Y0iZa CsMw== X-Gm-Message-State: AElRT7FhEcnOmuKpOSI357IGEWcVCsG2aldMixoaFUoF69R4R4Jt7lmY I7vXaljS5iXSF7JR/rk4+g9Eg5TpNWJSLwtN+rb90Q== X-Google-Smtp-Source: AG47ELvC0Rz8U3R32LPwLd2RGlo4ZRZURz4bA5AGFGR+2zR1ZwpfodIE4YuQ6/34MgYHYaB6H3NokNWBCCtpz4doeLE= X-Received: by 10.46.60.23 with SMTP id j23mr17175110lja.18.1521753931414; Thu, 22 Mar 2018 14:25:31 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.46.85.13 with HTTP; Thu, 22 Mar 2018 14:25:30 -0700 (PDT) In-Reply-To: <201803221921.w2MJLBi7058560@repo.freebsd.org> References: <201803221921.w2MJLBi7058560@repo.freebsd.org> From: Justin Hibbits Date: Thu, 22 Mar 2018 16:25:30 -0500 X-Google-Sender-Auth: cNNp4cKer7YtozdbquVcyAogTe4 Message-ID: Subject: Re: svn commit: r331369 - head/sys/vm To: Jeff Roberson Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 21:25:34 -0000 This broke gcc builds. On Thu, Mar 22, 2018 at 2:21 PM, Jeff Roberson wrote: > Author: jeff > Date: Thu Mar 22 19:21:11 2018 > New Revision: 331369 > URL: https://svnweb.freebsd.org/changeset/base/331369 > > Log: > Lock reservations with a dedicated lock in each reservation. Protect the > vmd_free_count with atomics. > > This allows us to allocate and free from reservations without the free lock > except where a superpage is allocated from the physical layer, which is > roughly 1/512 of the operations on amd64. > > Use the counter api to eliminate cache conention on counters. > > Reviewed by: markj > Tested by: pho > Sponsored by: Netflix, Dell/EMC Isilon > Differential Revision: https://reviews.freebsd.org/D14707 > > Modified: > head/sys/vm/vm_page.c > head/sys/vm/vm_pagequeue.h > head/sys/vm/vm_reserv.c > head/sys/vm/vm_reserv.h > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Thu Mar 22 19:11:43 2018 (r331368) > +++ head/sys/vm/vm_page.c Thu Mar 22 19:21:11 2018 (r331369) > @@ -177,7 +177,6 @@ static uma_zone_t fakepg_zone; > static void vm_page_alloc_check(vm_page_t m); > static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); > static void vm_page_enqueue(uint8_t queue, vm_page_t m); > -static void vm_page_free_phys(struct vm_domain *vmd, vm_page_t m); > static void vm_page_init(void *dummy); > static int vm_page_insert_after(vm_page_t m, vm_object_t object, > vm_pindex_t pindex, vm_page_t mpred); > @@ -1677,10 +1676,10 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi > * for the request class and false otherwise. > */ > int > -vm_domain_available(struct vm_domain *vmd, int req, int npages) > +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) > { > + u_int limit, old, new; > > - vm_domain_free_assert_locked(vmd); > req = req & VM_ALLOC_CLASS_MASK; > > /* > @@ -1688,15 +1687,34 @@ vm_domain_available(struct vm_domain *vmd, int req, in > */ > if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) > req = VM_ALLOC_SYSTEM; > + if (req == VM_ALLOC_INTERRUPT) > + limit = 0; > + else if (req == VM_ALLOC_SYSTEM) > + limit = vmd->vmd_interrupt_free_min; > + else > + limit = vmd->vmd_free_reserved; > > - if (vmd->vmd_free_count >= npages + vmd->vmd_free_reserved || > - (req == VM_ALLOC_SYSTEM && > - vmd->vmd_free_count >= npages + vmd->vmd_interrupt_free_min) || > - (req == VM_ALLOC_INTERRUPT && > - vmd->vmd_free_count >= npages)) > - return (1); > + /* > + * Attempt to reserve the pages. Fail if we're below the limit. > + */ > + limit += npages; > + old = vmd->vmd_free_count; > + do { > + if (old < limit) > + return (0); > + new = old - npages; > + } while (atomic_fcmpset_int(&vmd->vmd_free_count, &old, new) == 0); > > - return (0); > + /* Wake the page daemon if we've crossed the threshold. */ > + if (vm_paging_needed(vmd, new) && !vm_paging_needed(vmd, old)) > + pagedaemon_wakeup(vmd->vmd_domain); > + > + /* Only update bitsets on transitions. */ > + if ((old >= vmd->vmd_free_min && new < vmd->vmd_free_min) || > + (old >= vmd->vmd_free_severe && new < vmd->vmd_free_severe)) > + vm_domain_set(vmd); > + > + return (1); > } > > vm_page_t > @@ -1723,44 +1741,34 @@ vm_page_alloc_domain_after(vm_object_t object, vm_pind > again: > m = NULL; > #if VM_NRESERVLEVEL > 0 > + /* > + * Can we allocate the page from a reservation? > + */ > if (vm_object_reserv(object) && > - (m = vm_reserv_extend(req, object, pindex, domain, mpred)) > - != NULL) { > + ((m = vm_reserv_extend(req, object, pindex, domain, mpred)) != NULL || > + (m = vm_reserv_alloc_page(req, object, pindex, domain, mpred)) != NULL)) { > domain = vm_phys_domain(m); > vmd = VM_DOMAIN(domain); > goto found; > } > #endif > vmd = VM_DOMAIN(domain); > - vm_domain_free_lock(vmd); > - if (vm_domain_available(vmd, req, 1)) { > + if (vm_domain_allocate(vmd, req, 1)) { > /* > - * Can we allocate the page from a reservation? > + * If not, allocate it from the free page queues. > */ > + vm_domain_free_lock(vmd); > + m = vm_phys_alloc_pages(domain, object != NULL ? > + VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > + vm_domain_free_unlock(vmd); > + if (m == NULL) { > + vm_domain_freecnt_inc(vmd, 1); > #if VM_NRESERVLEVEL > 0 > - if (!vm_object_reserv(object) || > - (m = vm_reserv_alloc_page(object, pindex, > - domain, mpred)) == NULL) > + if (vm_reserv_reclaim_inactive(domain)) > + goto again; > #endif > - { > - /* > - * If not, allocate it from the free page queues. > - */ > - m = vm_phys_alloc_pages(domain, object != NULL ? > - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, 0); > -#if VM_NRESERVLEVEL > 0 > - if (m == NULL && vm_reserv_reclaim_inactive(domain)) { > - m = vm_phys_alloc_pages(domain, > - object != NULL ? > - VM_FREEPOOL_DEFAULT : VM_FREEPOOL_DIRECT, > - 0); > - } > -#endif > } > } > - if (m != NULL) > - vm_domain_freecnt_dec(vmd, 1); > - vm_domain_free_unlock(vmd); > if (m == NULL) { > /* > * Not allocatable, give up. > @@ -1775,9 +1783,7 @@ again: > */ > KASSERT(m != NULL, ("missing page")); > > -#if VM_NRESERVLEVEL > 0 > found: > -#endif 'found' is now declared, but unused on powerpc64. - Justin