Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1103727ybi; Fri, 21 Jun 2019 13:58:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwuCcawQUd2e9rbO8K/EMyYUk831V6J7vCDuOzO+MTwHffgm0oLZ9Vyf/eC0/PjOk74FnIh X-Received: by 2002:a63:ed06:: with SMTP id d6mr20409225pgi.267.1561150716598; Fri, 21 Jun 2019 13:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561150716; cv=none; d=google.com; s=arc-20160816; b=d9GRdAHD8XYHlgWzQTppLI6ZzNK9CAFDUsT/krCxVJmKe1G67f6nozuf7yma/+8vSn Uo4EAtoMHVQyV6Lt+T8/6L75zO4MF8ij9DuwBGGbVGINDiZ+NoRaq1AcQ/eNtn95lCUA JRuc3E+EbjhZ+Vlmdt9AF7CyqhtcOtSQyMB+ay6PWntx8uyhUYJTTZ1N4rMwPWlPdeKF q0BqI8iZ27q1dMjLaXfiHhgXToalxLu3WXx0DjpMaia9EftHM6x5Ts5z3uP873YRtcpg AQKWNLDzQkIsG57lX2gIKOYyn6rL0etI8k0DfJN2aVdASRHgN62dXgMVB+dBU0V/JSrB Uj7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=8yYOqvu5kX2LRYKzF9g/pziCLKwTlUixwBsdMp/H9Nc=; b=CQmkd7LW+N7YcLn9pGIvw7YTqB5S5RZ+AbopoWWzlXquhBQuBazNeU+FtzBrFRy+CK gttr63m1aMNt/vqDvzCAbTQyI4BB0mYHPDqH/p35NXEJe54t5dkD8J49JWEDJo3+FGC2 CvOMbjAtT3jRola6JnnmMzsvBzOmM1AWERc0Df1s1faTHp9dIE5MbE7iOV0TbKilAo/8 WUvfxVlxN6ZmeaDhO2GwP/X+oHQhQm1HQErcJeTwNMM1veHiWrfz1OaV8yi/CvZrsKj2 74MBwmDD+dHgOi9lqG98ZRUvBlf1kbNOCE7h/svXS1REh4n/xPjzUmbtoaAD3NhR2ewj GGpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cuDC9qVS; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si3372835plk.428.2019.06.21.13.58.20; Fri, 21 Jun 2019 13:58:36 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=cuDC9qVS; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726080AbfFUU6K (ORCPT + 99 others); Fri, 21 Jun 2019 16:58:10 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39160 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725985AbfFUU6K (ORCPT ); Fri, 21 Jun 2019 16:58:10 -0400 Received: by mail-pg1-f193.google.com with SMTP id 196so3920952pgc.6 for ; Fri, 21 Jun 2019 13:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=8yYOqvu5kX2LRYKzF9g/pziCLKwTlUixwBsdMp/H9Nc=; b=cuDC9qVShlq//zw6GpvnrOHJFr1tcJ4HACKd/9B6u34xyHNjsW0OOZZDRgr1qM5/Hp M0EB1zZM9gs5L8IJxIQGhXyVdveLkFnCOdJvfz/4XhENaTANN3GCW8/cP3RIrws83hYf NjmDQ0cqNT7vUgF56dqnL3z2x4Gapjcups6HVuJqAMMa/NjkniW/WC2yI0x1gkc+P1oR x+W55orwr1MH5BNxQsFA9adhAFgSOApJrYCp+37QsyH3D9VgVufcKKcs67USdy54C/lM H/QFupT5whQ6zNnOb0NQtQr+1v35QV8uptQ7kg+pJdyJOUZxnqhRROHJzPv+icVCuj+Y QuhA== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=8yYOqvu5kX2LRYKzF9g/pziCLKwTlUixwBsdMp/H9Nc=; b=cclHuvvOtDuNC9EZ5a3/5dmcb8CIwJWuXReDkiE9EPcfVbgOrVL7hdy2zyvStOcZY6 ESXmk6xB9YQV5K/lxHzTt6BFukR/NsYuSsiCIi84Jnf4uQu+vdeMN5KXx5/EDg5t7YYI nlETy2jC+gwlFK4NsLHeBvLENaeinWjCVfN04rOzwu6ymaMYgq2zrM82OFg+jdob7fqT cJkBo2nnZQPq/DbGRbQIcbQEv1yoku0ToG1LOrGfH2K463zV3O233n2HfzBybIpTp/dD 8AeHK3FIjrgwgvH7LnUso/hF5U0Zfi7JVNC6JexzIRTdxrMtFUTB1feUR8p+iTQJ0SdZ AAmw== X-Gm-Message-State: APjAAAXKAvEgsE4bk5uWubgk22YJ9rp01kVM7lbk1Q+bDql23WMd5N6L RiAArLrm7vOa7HNCvC6wZwCZnw== X-Received: by 2002:a17:90a:2562:: with SMTP id j89mr9083829pje.123.1561150689472; Fri, 21 Jun 2019 13:58:09 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id h1sm4763129pfo.152.2019.06.21.13.58.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 21 Jun 2019 13:58:08 -0700 (PDT) Date: Fri, 21 Jun 2019 13:58:08 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Alan Jenkins cc: linux-mm@kvack.org, Vlastimil Babka , Mel Gorman , linux-kernel@vger.kernel.org, Bharath Vedartham Subject: Re: [PATCH v2] mm: avoid inconsistent "boosts" when updating the high and low watermarks In-Reply-To: <20190621153107.23667-1-alan.christopher.jenkins@gmail.com> Message-ID: References: <3d15b808-b7cd-7379-a6a9-d3cf04b7dcec@suse.cz> <20190621153107.23667-1-alan.christopher.jenkins@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Jun 2019, Alan Jenkins wrote: > When setting the low and high watermarks we use min_wmark_pages(zone). > I guess this was to reduce the line length. Then this macro was modified > to include zone->watermark_boost. So we needed to set watermark_boost > before we set the high and low watermarks... but we did not. > > It seems mostly harmless. It might set the watermarks a bit higher than > needed: when 1) the watermarks have been "boosted" and 2) you then > triggered __setup_per_zone_wmarks() (by setting one of the sysctls, or > hotplugging memory...). > > I noticed it because it also breaks the documented equality > (high - low == low - min). Below is an example of reproducing the bug. > > First sample. Equality is met (high - low == low - min): > > Node 0, zone Normal > pages free 11962 > min 9531 > low 11913 > high 14295 > spanned 1173504 > present 1173504 > managed 1134235 > > A later sample. Something has caused us to boost the watermarks: > > Node 0, zone Normal > pages free 12614 > min 10043 > low 12425 > high 14807 > > Now trigger the watermarks to be recalculated. "cd /proc/sys/vm" and > "cat watermark_scale_factor > watermark_scale_factor". Then the watermarks > are boosted inconsistently. The equality is broken: > > Node 0, zone Normal > pages free 12412 > min 9531 > low 12425 > high 14807 > > 14807 - 12425 = 2382 > 12425 - 9531 = 2894 > > Co-developed-by: Vlastimil Babka > Signed-off-by: Vlastimil Babka > Signed-off-by: Alan Jenkins > Fixes: 1c30844d2dfe ("mm: reclaim small amounts of memory when an external > fragmentation event occurs") > Acked-by: Mel Gorman Acked-by: David Rientjes