Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp818010imm; Fri, 31 Aug 2018 14:17:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbVSGE8lB1FYnJSxYKNCL0fWbG0Vun6TInLjfbkgUZdmPh9XXRzHZzvok/E4AwtpU3M2fuS X-Received: by 2002:a17:902:47:: with SMTP id 65-v6mr4980154pla.293.1535750225467; Fri, 31 Aug 2018 14:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535750225; cv=none; d=google.com; s=arc-20160816; b=y1Wb0t/M6xisz7ijeqH6CDeVWDb1h7RAo0eU73lrm/oZhOkBP3Fbv540BM03yLHAQ5 etAK/VTdS1r4GmJU29MH1mODIRbpRbdWegedhJaOW/jU2GdmDDfrqaKdcEDucF/rLu3x 3Kkd7Y7nNqMxa3FQ0eQ3VWM4Jf4qOFVtlUotgFGXBRPLNFt2+BuTAWR4N9uaaptqgP/T +8bVK5m2pZS8VoWozPdY9IhfmOoqHERqEaWTq+CFdRoQDTKRGJp6PG8fulfPSE3lCu2A eFJvemGYPafCtjpkM0iAsj7GyT74bAyf+DkFi/0YgxWqocGWZNo1k0u8wPxUfpJwVs0H 7wUQ== 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:arc-authentication-results; bh=9GVaYZoZRS2xW5Ub8AmepJrSK+C9BA5BhRu4ygv+CA8=; b=VqI8QzKbT3I+GWCzH/HupNyYO+Gtl1VyVy5syia1VNxge7RYLUSvsk1T1zTcpy+gNy TiObt4JnvlKM7DNQ28M/Ov92MUDNCebfo1LXmi2PldiuMxcFT+r1g3SfNp4vtwmSVhSk 9a8EzIUdDBR+j2YbUfbF36K38mD7zBdLMx01hPrvcIhqbdi3H68Sx/lOS1MToKzTM6XE y70jRAqkTLe5tBx5F7FxJdSdAjrzLYHz7yAf5ZU1I5sXym4d9+FwyGCid2yvqA8CXOb1 H2+9jNjw+OEwsDf60/W6G9/BbFf6jrsDtw7KHvqG4kQ3b0zAj/OcYnLj0bJzi+IYVqn6 lXwA== 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 d41-v6si10527912pla.172.2018.08.31.14.16.50; Fri, 31 Aug 2018 14:17:05 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727286AbeIABZE (ORCPT + 99 others); Fri, 31 Aug 2018 21:25:04 -0400 Received: from shelob.surriel.com ([96.67.55.147]:53920 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727203AbeIABZE (ORCPT ); Fri, 31 Aug 2018 21:25:04 -0400 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.90_1) (envelope-from ) id 1fvqlX-00079X-Si; Fri, 31 Aug 2018 17:15:39 -0400 Message-ID: <3b05579f964cca1d44551913f1a9ee79d96f198e.camel@surriel.com> Subject: Re: [PATCH] mm: slowly shrink slabs with a relatively small number of objects From: Rik van Riel To: Roman Gushchin , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, Josef Bacik , Johannes Weiner , Andrew Morton Date: Fri, 31 Aug 2018 17:15:39 -0400 In-Reply-To: <20180831203450.2536-1-guro@fb.com> References: <20180831203450.2536-1-guro@fb.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-5zJmtvGhdpjMbqPTGgaf" 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 --=-5zJmtvGhdpjMbqPTGgaf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2018-08-31 at 13:34 -0700, Roman Gushchin wrote: > diff --git a/mm/vmscan.c b/mm/vmscan.c > index fa2c150ab7b9..c910cf6bf606 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -476,6 +476,10 @@ static unsigned long do_shrink_slab(struct > shrink_control *shrinkctl, > delta =3D freeable >> priority; > delta *=3D 4; > do_div(delta, shrinker->seeks); > + > + if (delta =3D=3D 0 && freeable > 0) > + delta =3D min(freeable, batch_size); > + > total_scan +=3D delta; > if (total_scan < 0) { > pr_err("shrink_slab: %pF negative objects to delete > nr=3D%ld\n", I agree that we need to shrink slabs with fewer than 4096 objects, but do we want to put more pressure on a slab the moment it drops below 4096 than we applied when it had just over 4096 objects on it? With this patch, a slab with 5000 objects on it will get 1 item scanned, while a slab with 4000 objects on it will see shrinker->batch or SHRINK_BATCH objects scanned every time. I don't know if this would cause any issues, just something to ponder. If nobody things this is a problem, you can give the patch my: Acked-by: Rik van Riel --=20 All Rights Reversed. --=-5zJmtvGhdpjMbqPTGgaf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAluJr/sACgkQznnekoTE 3oORTwgAv23YdpXURejxj0dK5yd07yA/fu6+B4F3wMqsPJOkSoctfZUWvPjVoYaC cFMh2AzoAg/nCn8hN7uetZKGbjYlLjNuKWAzSPEIn8Nay+H/erpYRKcdemCRHYg5 9CLxaxlFK/lBfuBEwjAvoiizmiuCOm+ZqtBSl5zO3k63TypAD9E8jYHKE02Inr3d WCwgkh2pUc0h0aSZZK2wmHj5ori86UAyjEBmrPmtPfktUwUqtmhQ8ewilyFVLylE N54npyirQF1/wxziYyFeaCZibE7vn8fjghAQmXzgJ8wXkd38FUyKUaUH7LT0KDXs JCzeNs24VoGD/JGH8WyoqOLUtrnQiw== =W3kT -----END PGP SIGNATURE----- --=-5zJmtvGhdpjMbqPTGgaf--