From owner-svn-src-head@freebsd.org Sat Sep 7 14:43:31 2019 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 B97D8D4470; Sat, 7 Sep 2019 14:43:31 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46QccL5hstz4dR4; Sat, 7 Sep 2019 14:43:30 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x730.google.com with SMTP id y144so522523qkb.7; Sat, 07 Sep 2019 07:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NCP+cTe5+/fi4kmB+n+KGr+xquXS49aIQ3Bp01b+XYQ=; b=Hsyn1mBAVXxJDd+Iw8pZzgcFk0kgD9F8PoQ8/t6N2T0V2Wb7MzB36Dazh9tphKyz5b b9rfwwkJbraWxJiHaYSI14HiLk5k98mdgxqEIzeEMXzrMhIY1NiMG7bf0QqFJQYRzxRN sya11ic/iYv2neXzgqk5L0MXbrtqGI8K+hHQgH3s9HJKDNmU2yXps1uyN2f0hMBVC2ej wYmqA41tga9g0i11I0RgKlvxlkMGnqcdJ9cLovhTHAkQ8seSBb8U8ba4VtlGZI3i2t1Q wSAte7BZGBcQov91tj/Mxj0w8AbZvYTVIqU0Y6X6A37GK63QVSRVKoVuKbfesBKAyHNp 0q3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=NCP+cTe5+/fi4kmB+n+KGr+xquXS49aIQ3Bp01b+XYQ=; b=LZLfhF/FoKaH5dmygnlDgUPBlay2gFnQo92Bu6Uu3GKhEeTirShqUnU07fJbLryydy v8bYUV4mHhwsvZ9/YrwbxRqLQensqaam8kCzssY3s6RXAbQEYa9hf8m4f7VbuDiV1FNM Jjvk2/zs1/RdHc2HGfDFRHExi0Htj+mMFWbI+j90kZ0r/gkqHuDQUyZpm0dD+3c3mD7N q7/mQ3BzOFVpoI5S8W/330DE8Pno4Q2SMRrZ91kt7/3H2iuUkRdina7VfHJvu5iVvTYY 6Ee2wtxzKX9xvKChND4PfWNI9sOZMmpVorOZTvfgQk9cA4aD3/BLP1xvq/UYvF2nGM66 KAIA== X-Gm-Message-State: APjAAAWXUzHCCkUrplspVAYCxg9GhzPyycN6bGYfPYKj1pHe3wqRrF2s BdJKnFrfEWBhvECIA0Y09Fo+KW+PhpQ= X-Google-Smtp-Source: APXvYqwoIE91GOhtznGoP+zmCnOYQ+yV3dFutSYr9VhQqQYhEEzeva/93EgsBGyk9P3+m24UkfB9JQ== X-Received: by 2002:a05:620a:794:: with SMTP id 20mr14094399qka.320.1567867408898; Sat, 07 Sep 2019 07:43:28 -0700 (PDT) Received: from spy ([50.235.236.73]) by smtp.gmail.com with ESMTPSA id x59sm4377615qte.20.2019.09.07.07.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2019 07:43:28 -0700 (PDT) Sender: Mark Johnston Date: Sat, 7 Sep 2019 10:43:23 -0400 From: Mark Johnston To: Andriy Gapon Cc: Slawa Olhovchenkov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r351673 - in head: lib/libmemstat share/man/man9 sys/cddl/compat/opensolaris/kern sys/kern sys/vm Message-ID: <20190907144323.GA6523@spy> References: <201909012222.x81MMh0F022462@repo.freebsd.org> <79c74018-1329-ee69-3480-e2f99821fa93@FreeBSD.org> <20190903161427.GA38096@zxy.spb.ru> <20190903220106.GB26733@raichu> <8b049a33-e844-1a47-2be1-c267946b8f95@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8b049a33-e844-1a47-2be1-c267946b8f95@FreeBSD.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-Rspamd-Queue-Id: 46QccL5hstz4dR4 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Hsyn1mBA; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::730 as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-1.07 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+ip6:2607:f8b0:4000::/36]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-2.89)[ip: (-9.39), ipnet: 2607:f8b0::/32(-2.75), asn: 15169(-2.27), country: US(-0.05)]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(0.00)[gmail.com:s=20161025]; RECEIVED_SPAMHAUS_CSS(4.00)[73.236.235.50.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.3]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; BAD_REP_POLICIES(0.10)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[0.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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: Sat, 07 Sep 2019 14:43:31 -0000 On Wed, Sep 04, 2019 at 09:27:00AM +0300, Andriy Gapon wrote: > On 04/09/2019 01:01, Mark Johnston wrote: > > Some of the vm_lowmem eventhandlers probably shouldn't be called each > > time the page daemon scans the inactive queue (every 0.1s under memory > > pressure). ufsdirhash_lowmem and mb_reclaim in particular don't seem > > like they need to be invoked very frequently. We could easily define > > multiple eventhandlers to differentiate between these cases, though. > > My proposal is to run uma_reclaim(UMA_RECLAIM_TRIM) before invoking vm_lowmem. > If that reclaims "enough" memory, then do not call vm_lowmem at all. > > Oh, and I have a related question. > Say, a zone has X items in use and Y items in cache. > After running vm_lowmem the composition changes to X - C and Y + C respectively. > Then we run uma_reclaim(UMA_RECLAIM_TRIM). > Question: is that guaranteed to free at least C items? No. The estimation cannot distinguish between items that were freed as a result of a lowmem request vs. those that were freed as a regular operation. As a result it considers the extra C items as part of the cache's working size. > I am thinking about a possibility that the zone's workset size is estimated to > be at least X (and maybe even more than X + Y). In that case UMA_RECLAIM_TRIM > won't free those C items, they will stay in the cache. So, it seems like > releasing them was in vain, at least for the immediate reclaim. This is true. Of course, the items may eventually become reclaimable as the estimate decays.