Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2228833imm; Tue, 4 Sep 2018 00:03:24 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbWdxYGLo5CQI6Smu8Q2vrgff2Cz1eN1NUqh5gaYGh8P6c/0TkJ0fP/C8X8PC23sCqiZUBB X-Received: by 2002:a17:902:8bc4:: with SMTP id r4-v6mr31239021plo.124.1536044604248; Tue, 04 Sep 2018 00:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536044604; cv=none; d=google.com; s=arc-20160816; b=hvT/fasa3OVTHRKeC98wEDgz0xlzXj3rwLLLHCfSEiqUu45fbjuVLqN24+T6JHYtxF WMY2/3fbTk56BRcrJkAK8WJkvYYYWtGs/mnSiDmzyquePbThTZpqiQUrl3NemIVa7PTo TpmJM8KYJMRQ+Hh/D9hd1s9Kb7tQSplndJ5cLLJ8m2uNjzRmiNfUeyg3axe9e5A2HZPy v+K7Nj36SOBxxjOVJS2fs2fUALnqN3bm0m1ZxDr0QtwGhQ0Dsb6vKTyP0F4isA1kxgYJ 6zj0QFYoifnafnvRc3d01P+IyK5zYT+MZGbEv8R6IcUsSxs0UWe4alKjrWTJZT5cV35u VAzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=9iMWa6hd6IAkL8UUVSmCYd901XKXojJcKzxDbEyPbHM=; b=AgWz+JHlfYbux4grw6xeXQk9VubHMeV3/s0LEiJ59fu5PQDkU4dZ3wl0VDvKDIM6Q2 lT5FS5yCOzjaxHjuzb9hXfbldaZxjaKV7ecpmDVGStLBLhgXaXaE2mGRSj1/8NnWNYq0 zMfioB8vg2rCu4iQCia55rlVd4tsGHt6IyZqnvQFWit34NMCgW4qx0KEAG88iScep7Gi 06cMkJHx0vy/OwMpKP9IyTVjFLI25h1zecGsD+gzp5CQGMm0qELMDn0n5LXlyPh8OAAA rayNOL5ZC2aAKI66TiuRvcLQLRnCRKbokXEFLIkS0EwbYBIf2rIXQQH0URwChuIB4puT kbhQ== 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 3-v6si21289686plc.282.2018.09.04.00.03.08; Tue, 04 Sep 2018 00:03:24 -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 S1727068AbeIDLXx (ORCPT + 99 others); Tue, 4 Sep 2018 07:23:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:37148 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726041AbeIDLXw (ORCPT ); Tue, 4 Sep 2018 07:23:52 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2FF5AAEFD; Tue, 4 Sep 2018 07:00:07 +0000 (UTC) Date: Tue, 4 Sep 2018 09:00:05 +0200 From: Michal Hocko To: Roman Gushchin Cc: Rik van Riel , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, Josef Bacik , Johannes Weiner , Andrew Morton Subject: Re: [PATCH] mm: slowly shrink slabs with a relatively small number of objects Message-ID: <20180904070005.GG14951@dhcp22.suse.cz> References: <20180831203450.2536-1-guro@fb.com> <3b05579f964cca1d44551913f1a9ee79d96f198e.camel@surriel.com> <20180831213138.GA9159@tower.DHCP.thefacebook.com> <20180903182956.GE15074@dhcp22.suse.cz> <20180903202803.GA6227@castle.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180903202803.GA6227@castle.DHCP.thefacebook.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 03-09-18 13:28:06, Roman Gushchin wrote: > On Mon, Sep 03, 2018 at 08:29:56PM +0200, Michal Hocko wrote: > > On Fri 31-08-18 14:31:41, Roman Gushchin wrote: > > > On Fri, Aug 31, 2018 at 05:15:39PM -0400, Rik van Riel wrote: > > > > 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 = freeable >> priority; > > > > > delta *= 4; > > > > > do_div(delta, shrinker->seeks); > > > > > + > > > > > + if (delta == 0 && freeable > 0) > > > > > + delta = min(freeable, batch_size); > > > > > + > > > > > total_scan += delta; > > > > > if (total_scan < 0) { > > > > > pr_err("shrink_slab: %pF negative objects to delete > > > > > nr=%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. > > > > > > Hm, fair enough. So, basically we can always do > > > > > > delta = max(delta, min(freeable, batch_size)); > > > > > > Does it look better? > > > > Why don't you use the same heuristic we use for the normal LRU raclaim? > > Because we do reparent kmem lru lists on offlining. > Take a look at memcg_offline_kmem(). Then I must be missing something. Why are we growing the number of dead cgroups then? -- Michal Hocko SUSE Labs