Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp1776719imc; Fri, 22 Feb 2019 10:58:44 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib7sJT94BzS4h9hMXMqHgRiNGFQWczQHuQUOdAoJFDF/V9b/6eh79KNxW6odfmoJkvlt0E4 X-Received: by 2002:a65:6658:: with SMTP id z24mr5343130pgv.189.1550861924532; Fri, 22 Feb 2019 10:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550861924; cv=none; d=google.com; s=arc-20160816; b=pXc99W2UjT6jq19G4dNUHGE5CqrGpFH4cEeP49Ursa/xKn8fgEXC1g1xOUGuJuXrcL JIqY3HH3gDjoZeFP48+37/hXgvhqxHI54lnqLI676zYZ6Uo67B7grFuQOrgjTEPdKX57 lmKOV5ehfsWDr8kJspUpKUjmSoH5FKS4rSZtSZFI4zQanHpc0if8DksqF0CDM5zXlPc+ KjYDoDCsppg+s1MddOE3ssguZeN9bg9p8EK4oGdtZEnVfs+kol6zhdj+d3iSV1KuvqEn 3o4wh3L+FD64V/1mg7H0ZoBvlhcK60paKARvpHqx0auMiiD+crj8Sl/gxwyqv61isI8q SKkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to:date :cc:to:from:subject:message-id; bh=2CYdQPsOMc1PG7mbT5ICeMhdtQOIdRtv1XXJNQE7gFg=; b=neuQSaCrEwbCdI21tj09hg9wvu++qOdIZHfn73JlZpE0GZqNg3A6Wc/SPOOh+WC8tO Ria2yFq31vewk25XmNon+yamhdeT4o0N5ZRjEItD/j5dPMo1cLZ31duCGZI474VoHMtc RcYQKsfj9enqn2Fym599h5NR6RIDL8Q14+KsLixpoI/amnmjZ6D5D3I2+FChEmYdauH/ 25tXSyM3iHd4YHUGPZuIuJFsXilsU87C+t+hPSKyhI1XE0wqueowkmCRxlcOmLRTf6qU st/VKPtdrGCxxzFpl7nKJj1LtQK9OT8ViARnYx5jBZr/t1FtBJuJ81k0wSDHybc/DO4L TIZg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si167291pfa.270.2019.02.22.10.58.28; Fri, 22 Feb 2019 10:58:44 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726242AbfBVS4T (ORCPT + 99 others); Fri, 22 Feb 2019 13:56:19 -0500 Received: from shelob.surriel.com ([96.67.55.147]:56494 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbfBVS4T (ORCPT ); Fri, 22 Feb 2019 13:56:19 -0500 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gxFzZ-0005ky-Qo; Fri, 22 Feb 2019 13:56:13 -0500 Message-ID: Subject: Re: [PATCH RFC] mm/vmscan: try to protect active working set of cgroup from reclaim. From: Rik van Riel To: Andrey Ryabinin , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Vlastimil Babka , Mel Gorman , Roman Gushchin , Shakeel Butt Date: Fri, 22 Feb 2019 13:56:13 -0500 In-Reply-To: <20190222175825.18657-1-aryabinin@virtuozzo.com> References: <20190222175825.18657-1-aryabinin@virtuozzo.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-zrqnWZMPMJ+zyetOZuRD" X-Mailer: Evolution 3.28.5 (3.28.5-1.fc28) Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-zrqnWZMPMJ+zyetOZuRD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2019-02-22 at 20:58 +0300, Andrey Ryabinin wrote: > In a presence of more than 1 memory cgroup in the system our reclaim > logic is just suck. When we hit memory limit (global or a limit on > cgroup with subgroups) we reclaim some memory from all cgroups. > This is sucks because, the cgroup that allocates more often always > wins. > E.g. job that allocates a lot of clean rarely used page cache will > push > out of memory other jobs with active relatively small all in memory > working set. >=20 > To prevent such situations we have memcg controls like low/max, etc > which > are supposed to protect jobs or limit them so they to not hurt > others. > But memory cgroups are very hard to configure right because it > requires > precise knowledge of the workload which may vary during the > execution. > E.g. setting memory limit means that job won't be able to use all > memory > in the system for page cache even if the rest the system is idle. > Basically our current scheme requires to configure every single > cgroup > in the system. >=20 > I think we can do better. The idea proposed by this patch is to > reclaim > only inactive pages and only from cgroups that have big > (!inactive_is_low()) inactive list. And go back to shrinking active > lists > only if all inactive lists are low. Your general idea seems like a good one, but the logic in the code seems a little convoluted to me. I wonder if we can simplify things a little, by checking (when we enter page reclaim) whether the pgdat has enough inactive pages based on the node_page_state statistics, and basing our decision whether or not to scan the active lists off that. As it stands, your patch seems like the kind of code that makes perfect sense today, but which will confuse people who look at the code two years from now. If the code could be made a little more explicit, great. If there are good reasons to do things in the fallback way your current patch does it, the code could use some good comments explaining why :) --=20 All Rights Reversed. --=-zrqnWZMPMJ+zyetOZuRD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAlxwRc0ACgkQznnekoTE 3oOzJgf+IxsPL5yIB5u027UvllE62JRrGLEE5jT6pUWMuilQAYqXRs4OJ+dUXeJG ZFT/XqnrA8OQ+HtA9yZ7qvu8O4QxQvrHA2DD3Xvc62SyuMQn+07JT6oreNsXSAJR j4M3bvj8SGycS81sImxx7q5TYB+QSpBsYOzHYultqY4gO6xiAiCU4+FNuO9V1OoI jVLuIp0aMmbMhE9lEWzMLPfPBMH3uZFELmPXTJDlE6G8Cd1CTAzFj41Po99yYN0w BtdHFWSU2cmSg/aKVJCGgVoC93EiL6m7DcuYJWQtgWVJ+tVxVwPIZ/ICHRbC0deo 19rUK2TX7FzIBhReWch3aVNGDnokBg== =VKDb -----END PGP SIGNATURE----- --=-zrqnWZMPMJ+zyetOZuRD--