Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp523909ybh; Thu, 12 Mar 2020 06:27:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt42IXv3n/LFael4bYjtq0i0QRvbH2woqQzD2+7KO/xQ1K0+VONyXK8eYUt5KFQMIxo68ZQ X-Received: by 2002:a05:6830:129a:: with SMTP id z26mr6480936otp.179.1584019640052; Thu, 12 Mar 2020 06:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584019640; cv=none; d=google.com; s=arc-20160816; b=CJSm03hmIDO9BLwb2j8wAfF1Uq82p6mqnI+D4GoeMYfCjTeHjktYTme+J622AH6vNl 1XDd2k0cXKp3eX1JCiIa6KAdY+O31enR98r7+XuLrZqNyVsPD/LUEC4CQTp6jMgJP45H wX0EPEflmVvozecGAMzzAvZxH8lmioEgNnSeVaebPbpZh6dAGDGGW+B5KoZxXP8hrpPI ebBweHBNDQC6bYc6sBVXCpmQJozje76iOxAipoRXV8QBDlW11fCfVGN6BbEqEUfO1YH8 2265hTsKFqjPYhxKl3co3KsKx89BJ9mjoCj8GCZG+av8JQryr/qfD9UaaHLen4bjprQ2 kGoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=4BJbL1v35eEIhi8zAOoH4R9OkyA1Pa/qt0AezIWPz+Y=; b=ggvP0sAFoU0lBbW5ffpRSFU4xu2nv+H6tOLViubFz8ZKY3WkSwj0MaiA5DlQm5Z+UC q/y7mqZ5/0v+KMUOgDR2iWj/EUzbPoO6XHEIeSuJlrHghMd6Ze0S9oJDQIYFHXyKqAxt hWORI62q0wJq/dslDPvTIxO0XB817HqBGKTI+ObuR2p8NMuLBkDUXu4KqiwcGKGctlh3 XJE8a+kD8nsxDtdUGY3chzYsPpNV7fq+v1vMMCB6OP+ustud64rVzfh74feXf/cTgFVn 0AWrhhJuHeUpbQ1uPZO+PBvqs9hWgbPwqPbwfnHs54nBHmqfZxtsqg0FzzUb6fJpQa3D M+tA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si2494022oie.88.2020.03.12.06.27.07; Thu, 12 Mar 2020 06:27:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727240AbgCLN0x (ORCPT + 99 others); Thu, 12 Mar 2020 09:26:53 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33046 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726299AbgCLN0w (ORCPT ); Thu, 12 Mar 2020 09:26:52 -0400 Received: by mail-wr1-f66.google.com with SMTP id a25so7485328wrd.0; Thu, 12 Mar 2020 06:26:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4BJbL1v35eEIhi8zAOoH4R9OkyA1Pa/qt0AezIWPz+Y=; b=bdh5KUbHizwaomUcweOIOrIOA4O3vKD/UclEHlOQhloPhK3YwpoGg3yLKKzoqHpnrL dXcGOi/7kz0+Z/6rgG0LApfgGtwDj1xvUUB6wCDedtveLhJ4coswJWoonQcwxhPUwWHF XuPtG2eNYB3G9jYCccbAxDNAiiZkbR5+KCLdqKroShMZc1zBtO7g7n4xUMHietRUkHe7 YewlYh3ASjxzmHiKoPBWK32d1v0r+I7/OhTWNXRoQ3tmB8kS5IoU22tVZKzHwbsGLTS/ KQyS125AjEj6hACYUNh6H/q0888Z9MbufTZDZVie/p/PjUt7pvSvrgylk4VuhLQ8T07c xgDw== X-Gm-Message-State: ANhLgQ1AITxYk8G/ZN3rS/YeeamCfNt77hTVM0jnJhsA3o706EEMIgG9 hW0K/Ls43C7Xsi7PybrP3U8= X-Received: by 2002:a5d:66cc:: with SMTP id k12mr11905427wrw.157.1584019610763; Thu, 12 Mar 2020 06:26:50 -0700 (PDT) Received: from localhost (ip-37-188-253-35.eurotel.cz. [37.188.253.35]) by smtp.gmail.com with ESMTPSA id w8sm12933799wmm.0.2020.03.12.06.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 06:26:49 -0700 (PDT) Date: Thu, 12 Mar 2020 14:26:42 +0100 From: Michal Hocko To: Ivan Teterevkov Cc: "corbet@lwn.net" , "akpm@linux-foundation.org" , "mchehab+samsung@kernel.org" , "tglx@linutronix.de" , "jpoimboe@redhat.com" , "pawan.kumar.gupta@linux.intel.com" , "jgross@suse.com" , "oneukum@suse.com" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Subject: Re: [PATCH] mm/vmscan: add vm_swappiness configuration knobs Message-ID: <20200312132642.GW23944@dhcp22.suse.cz> References: <20200312092531.GU23944@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 12-03-20 12:54:19, Ivan Teterevkov wrote: > On Thurs, 12 Mar 2020, Michal Hocko wrote: > > > On Wed 11-03-20 17:45:58, Ivan Teterevkov wrote: > > > This patch adds a couple of knobs: > > > > > > - The configuration option (CONFIG_VM_SWAPPINESS). > > > - The command line parameter (vm_swappiness). > > > > > > The default value is preserved, but now defined by CONFIG_VM_SWAPPINESS. > > > > > > Historically, the default swappiness is set to the well-known value > > > 60, and this works well for the majority of cases. The vm_swappiness > > > is also exposed as the kernel parameter that can be changed at runtime too, > > e.g. > > > with sysctl. > > > > > > This approach might not suit well some configurations, e.g. > > > systemd-based distros, where systemd is put in charge of the cgroup > > > controllers, including the memory one. In such cases, the default > > > swappiness 60 is copied across the cgroup subtrees early at startup, > > > when systemd is arranging the slices for its services, before the > > > sysctl.conf or tmpfiles.d/*.conf changes are applied. > > > > > > One could run a script to traverse the cgroup trees later and set the > > > desired memory.swappiness individually in each occurrence when the > > > runtime is set up, but this would require some amount of work to > > > implement properly. Instead, why not set the default swappiness as early as > > possible? > > > > I have to say I am not a great fan of more tunning for swappiness as this is quite > > a poor tunning for many years already. It essentially does nothing in many cases > > because the reclaim process ignores to value in many cases (have a look a > > get_scan_count. I have seen quite some reports that setting a specific value for > > vmswappiness didn't make any change. The knob itself has a terrible semantic to > > begin with because there is no way to express I really prefer to swap rather than > > page cache reclaim. > > > > This all makes me think that swappiness is a historical mistake that we should > > rather make obsolete than promote even further. > > Absolutely agree, the semantics of the vm_swappiness is perplexing. > Moreover, the same get_scan_count treats vm_swappiness and cgroups > memory.swappiness differently, in particular, 0 disables the memcg swap. > > Certainly, the patch adds some additional exposure to a parameter that > is not trivial to tackle but it's already getting created with a magic > number which is also confusing. Is there any harm to be done by the patch > considering the already existing sysctl interface to that knob? Like any other config option/kernel parameter. It is adding the the overall config space size problem and unless this is really needed I would rather not make it worse. -- Michal Hocko SUSE Labs