Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3854798imu; Mon, 28 Jan 2019 12:04:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN517c9hHkgogXbSEvRQEyCVvJBYvXUSUr0puXN+fot7E12tSaqYaa7VTvpgFpW7NXH/Dx9g X-Received: by 2002:a63:7e1a:: with SMTP id z26mr20541111pgc.216.1548705872228; Mon, 28 Jan 2019 12:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548705872; cv=none; d=google.com; s=arc-20160816; b=nuEnOl2cE03JEZABNypZw0wXbkUzs++QdoHPw1o/jCbivwxbK69MfuftXev3LLeaNS phkqkvhmtX+gkkLnKhh9DvFDepkJXFhqXNEiTjpAbkXpeNfzaHyfzp+NO1KkfbEyLZqd A8pBadEMi6a42RbHjq7sfCKi5FTuWhNe9guMQM/16NPjqPHCvSO1l9/VxBYmDBuLwfdN LY/QLWr4alNq8V8q9sGnOVUV6s8uhi+glUAKhX5ij4mn01oYMW0IF1HWzJN/pnNkizdb T7itvPPEIK5hByJBMeLnlBo9WIu30lc1p08sU4WI4bvVyasb2sRdABPdrts8wKFc0rk6 pAng== 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=4JPUVXt2AnmUGHhYL0L59IVWanFzQLuUqKIUT03lwS0=; b=Z/T9bQZA9ePP3oVipa0ayxZC56g+9VV8bst7JW2iqh1hkSiLc8mcgpo0XAEp4XAwp5 ixJCFAaAj1ThLx9UnoAmk5oq/GZQCTN36MLIIKETQke9+/ihwT/eIpk36pmvGNLXv310 lEwYjYfU6RuJu53SBDTW/xXCvm5zDowuYAyYhm/JrpVflkAm4mmJeeiX0w+k5UnFvrVq E8R0MupERAj9Ct18SVxSu/7Oe1/CTaaQXvvWB4Rz7nZiVwi8MJMFya1D5t28WQ4bE8x3 Us0O0SzvkjRoTPRbekxMqyoHarnLCXhr4lOtXwZFd67Zcu9gPaQsHy1mrtcb6mjxw8lp ukwg== 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 t20si34794758plj.94.2019.01.28.12.04.16; Mon, 28 Jan 2019 12:04:32 -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 S1727730AbfA1UDd (ORCPT + 99 others); Mon, 28 Jan 2019 15:03:33 -0500 Received: from shelob.surriel.com ([96.67.55.147]:42936 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726661AbfA1UDd (ORCPT ); Mon, 28 Jan 2019 15:03:33 -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 1goD7w-0006yz-Lt; Mon, 28 Jan 2019 15:03:28 -0500 Message-ID: <8ddf2ea674711f373062f4e056dd14fb81c5a2fe.camel@surriel.com> Subject: Re: [PATCH] mm,slab,vmscan: accumulate gradual pressure on small slabs From: Rik van Riel To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@fb.com, Johannes Weiner , Chris Mason , Roman Gushchin , Michal Hocko Date: Mon, 28 Jan 2019 15:03:28 -0500 In-Reply-To: <20190128115424.df3f4647023e9e43e75afe67@linux-foundation.org> References: <20190128143535.7767c397@imladris.surriel.com> <20190128115424.df3f4647023e9e43e75afe67@linux-foundation.org> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-nGE8UQknFPEiL8nfsYnb" 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 --=-nGE8UQknFPEiL8nfsYnb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2019-01-28 at 11:54 -0800, Andrew Morton wrote: > On Mon, 28 Jan 2019 14:35:35 -0500 Rik van Riel > wrote: >=20 > > /* > > * Make sure we apply some minimal pressure on default priority > > - * even on small cgroups. Stale objects are not only consuming > > memory > > + * even on small cgroups, by accumulating pressure across > > multiple > > + * slab shrinker runs. Stale objects are not only consuming > > memory > > * by themselves, but can also hold a reference to a dying > > cgroup, > > * preventing it from being reclaimed. A dying cgroup with all > > * corresponding structures like per-cpu stats and kmem caches > > * can be really big, so it may lead to a significant waste of > > memory. > > */ > > - delta =3D max_t(unsigned long long, delta, min(freeable, > > batch_size)); > > + if (!delta) { > > + shrinker->small_scan +=3D freeable; > > + > > + delta =3D shrinker->small_scan >> priority; > > + shrinker->small_scan -=3D delta << priority; > > + > > + delta *=3D 4; > > + do_div(delta, shrinker->seeks); >=20 > What prevents shrinker->small_scan from over- or underflowing over > time? We only go into this code path if delta >> DEF_PRIORITY is zero. That is, freeable is smaller than 4096. > I'll add this: > whitespace fixes, per Roman Awesome, thank you! --=20 All Rights Reversed. --=-nGE8UQknFPEiL8nfsYnb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAlxPYBAACgkQznnekoTE 3oN05AgAngaeuhkjCHuyhq8zG04YT0jvQFZoWcNexTYi/rVLmxraUqdOJhpgIvFl YMidQJwFi1448jznIdXf3/dgyvbu5JI+JoyhwlfmLv8wyHGWo59AfSkCT8bAPKR5 qHFY0TQCoOM/QyIW5Qeew5iHjNxceZfLvXNQVlt02jPoR5ysBWC9mudPYHAcTggZ 4fH8MkS8ukd8ykvx+WbEoO8GzTQrqwcc8bvPsl+mq7I+H2V6J1JhzQON3BSYZnNG 1SWKuzYdAYP6pxUXYweEl2YkTm4KtNgcxLPF3T8h99Gwa1/Nb9SvWSp6oZB4s9UD SWeY7MLKfnBK5aox7F+ilHrcYJrMfw== =O2ss -----END PGP SIGNATURE----- --=-nGE8UQknFPEiL8nfsYnb--