From owner-svn-src-all@freebsd.org Wed Nov 21 18:01:47 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 2071411407AC; Wed, 21 Nov 2018 18:01:47 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 29E8A6E204; Wed, 21 Nov 2018 18:01:46 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-io1-xd42.google.com with SMTP id l14so4563942ioj.5; Wed, 21 Nov 2018 10:01:46 -0800 (PST) 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=PjFa47lw4/av+KRz46OGp32X+oV8TdQzseRpOqBMSfQ=; b=VmWqz+wAzVJvR5WzvXzwLN5Hys3Bifw9lyLKj33QgAREWvWd8yiFTz5uxQL0/4kfPz kfbEgtOjM9UsTWfSeJf5jwVpre21zJAB88Uil3xcvQV8jprJAjkTbYj62CN61HjEyyzJ znwH9Y0ihCUu2ucjNJK4qwk/CTknYTbAWdiUGuMOYNcyuST/2TjfyoZJnIfWtr1iwIgj ldJsb7GzcFo/m4HVh6Bra/svWtXJr+lcsr4lrQRdCh3/hIb53BAMikhiPnfQ2EtmB95p yDSRk9WN2JJ31uH+EfwwIMiUivwlw2LJ+vQgleSZVIzAAbXbyH9opZf2dNKBawgQPyuL Oklw== 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=PjFa47lw4/av+KRz46OGp32X+oV8TdQzseRpOqBMSfQ=; b=aKH2ryiNkpoz4P6rXgsVi9d+5yvwdx9JPzLIZWj6TnNif6q0ImSWSirseQuJDT6GjN in3vDEL1oqrdpVzVzI8ipUVK4w6H/zLZM+Ksb+8W/U8vcw5RvD/xa3efwq41btpzMy9y 8aRy2whkY49GwP+lVgiXT1XlmrCtUN7Nh6zywIw9aLH+pJvjLReACCPh+BJxC6JdITKo 5L6Z1plFEcomExIw9T3WBmMU5tjUSsvwm0ct7OfXMCrXig9kvBTVtRYz2CuGMiqTlNi6 rSxDnkBHj6Vpd8gefT1nP+J2v4T3ux/JnAtY3NruI/4diP64JIqn64+lIFHSDyFUNtA9 JxhA== X-Gm-Message-State: AA+aEWbVsUNIvK6IvNkX28f1EkxskrBqyisKW7w55ydpwxXPrUcJZ9ZX Q9WWiJ6mKP84cCaiRYa5iwY= X-Google-Smtp-Source: AFSGD/WhlBaGffyfBbLGr5m0eb/84zdOjyAdv5ofUwJInCsmVyU+6MV65FGZi2wx4ayOYEdHr9QdDA== X-Received: by 2002:a5d:9046:: with SMTP id v6mr5299339ioq.49.1542823305425; Wed, 21 Nov 2018 10:01:45 -0800 (PST) Received: from raichu (toroon0560w-lp130-07-64-229-95-98.dsl.bell.ca. [64.229.95.98]) by smtp.gmail.com with ESMTPSA id q23sm6517252ioi.66.2018.11.21.10.01.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Nov 2018 10:01:44 -0800 (PST) Sender: Mark Johnston Date: Wed, 21 Nov 2018 13:01:42 -0500 From: Mark Johnston To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r340709 - in head/sys: compat/linuxkpi/common/include/linux vm Message-ID: <20181121180142.GF67072@raichu> References: <201811202249.wAKMnJxH082469@repo.freebsd.org> <20181121003515.GE2630@raichu> <20181121004239.spk72g2pikvse4y7@smtp.freebsd.org> <20181121005148.GF2630@raichu> <20181121005832.ongabjesxlsd7cqu@smtp.freebsd.org> <20181121060716.GE2378@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181121060716.GE2378@kib.kiev.ua> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 29E8A6E204 X-Spamd-Result: default: False [-2.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com]; NEURAL_HAM_MEDIUM(-0.96)[-0.961,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-0.93)[-0.926,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[2.4.d.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]; NEURAL_HAM_SHORT(-0.63)[-0.627,0]; IP_SCORE(-0.28)[ip: (2.60), ipnet: 2607:f8b0::/32(-2.34), asn: 15169(-1.56), country: US(-0.09)]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MID_RHS_NOT_FQDN(0.50)[]; 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] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: Wed, 21 Nov 2018 18:01:47 -0000 On Wed, Nov 21, 2018 at 08:07:16AM +0200, Konstantin Belousov wrote: > On Tue, Nov 20, 2018 at 04:58:32PM -0800, Ben Widawsky wrote: > > On 18-11-20 19:51:48, Mark Johnston wrote: > > > On Tue, Nov 20, 2018 at 04:42:39PM -0800, Ben Widawsky wrote: > > > > On 18-11-20 19:35:15, Mark Johnston wrote: > > > > > On Tue, Nov 20, 2018 at 10:49:19PM +0000, Ben Widawsky wrote: > > > > > > Author: bwidawsk > > > > > > Date: Tue Nov 20 22:49:19 2018 > > > > > > New Revision: 340709 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/340709 > > > > > > > > > > > > Log: > > > > > > linuxkpi: Add some basic swap functions > > > > > > > > > > > > These are used by kms-drm to determine various heuristics relate > > > > > > memory conditions. > > > > > > > > > > > > The number of free swap pages is just a variable, and it can be > > > > > > much cheaper by either adding a new getter, or simply extern'ing > > > > > > swap_total. However, this patch opts to use the more expensive, > > > > > > existing interface - since this isn't an operation in a high per > > > > > > path. > > > > > > > > > > > > This allows us to remove some more gpl linuxkpi and do the follo > > > > > > kms-drm: > > > > > > git rm linuxkpi/gplv2/include/linux/swap.h > > > > > > > > > > > > Reviewed by: mmacy, Johannes Lundberg > > > > > > Approved by: emaste (mentor) > > > > > > Differential Revision: https://reviews.freebsd.org/D18052 > > > > > > > > > > > > Added: > > > > > > head/sys/compat/linuxkpi/common/include/linux/swap.h (contents, props changed) > > > > > > Modified: > > > > > > head/sys/vm/vm_pageout.h > > > > > > head/sys/vm/vm_swapout.c > > > > > > > > > > > > [...] > > > > > > Modified: head/sys/vm/vm_swapout.c > > > > > > ============================================================================== > > > > > > --- head/sys/vm/vm_swapout.c Tue Nov 20 22:24:18 2018 (r340708) > > > > > > +++ head/sys/vm/vm_swapout.c Tue Nov 20 22:49:19 2018 (r340709) > > > > > > @@ -961,3 +961,10 @@ swapout(struct proc *p) > > > > > > p->p_swtick = ticks; > > > > > > return (0); > > > > > > } > > > > > > + > > > > > > +/* Used to determine if the current process is itself the reaper. */ > > > > > > +bool > > > > > > +vm_curproc_is_vmproc(void) > > > > > > +{ > > > > > > + return curproc == vmproc; > > > > > > +} > > > > > > > > > > From a look at how this is used, it should probably be pageproc rather > > > > > than vmproc. There are various code paths that just check > > > > > curproc == pageproc inline. > > > > > > > > > > > > > Could I trouble you for a quick explanation of the difference between the two? > > > > > > pageproc contains the page daemon and laundry threads, which are > > > responsible for managing the LRU page queues and writing back dirty > > > pages. vmproc's main task is to swap out kernel stacks when the system > > > is under memory pressure, and swap them back in when necessary. It's a > > > somewhat legacy component of the system and isn't required. You can > > > build a kernel without it by specifying "options NO_SWAPPING" (which is > > > a somewhat misleading name), in which vm_swapout_dummy.c is compiled > > > instead of vm_swapout.c. > > > > > > > Thanks for the explanation. I indeed want the page daemon. I will put up a patch > > to do that the correct way. Thanks. > > What is the intent ? If the goal is to avoid wait for memory in > deadlock- prone contexts, then you perhaps want to return true for both > pagedaemon and vm daemon, and might be even the buf daemon threads as > well. In this case it's used to enable more aggressive shrinking of GEM objects. The function in question is invoked via a lowmem eventhandler, so the page daemon may indeed be the caller.