Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp389363pxb; Thu, 21 Jan 2021 09:24:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjdbe/1d9ffV+TLRxfkyBNmGgqcwsRun2GRJOuaZSZ6H+x5vajx3S6Uw18N2/1OrPgmeE6 X-Received: by 2002:a17:906:ce5b:: with SMTP id se27mr343118ejb.57.1611249876854; Thu, 21 Jan 2021 09:24:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611249876; cv=none; d=google.com; s=arc-20160816; b=mV2NYyzHwWHgmwdqabkozcT2jqJ3j8JBNxEaJN7B4NHtTRDX/bg4W9me78sLJ9HodH rIisRpkPu0HAq90wjYytAwIhnuTuvEZnul1l6KKGGpU8FDxtDmw2T5dOBxpLg3tDYbJP 1sFNJh6dqKDtHQOf5ZHYkh0Tg16+J0JU8CqDBxVOlfGo1wnQBBKADAYiX7VBZs8y6h/r j9zhlYsoc1mjAK/OmDZI5MBLCcJ9p/xtAIiyF/2+4aJdnvQ5wRHZxZCxxvAvdNRheig2 RzjEit1m0A/pGsuUBRK6/IQPQcwhnMtrUUcPWq/PldKKP5Q92Z1jGD8P3yk4OwtjHVGb uHQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=XuUr3aOWWTF2LEBgZpj6FMX2YgEl3OkdjaSW4eMcu7o=; b=kbtjASt0KCF7BxbxDLWWbn4l+D2dQ53GnvaYxAecH/uCMGCsksC9m0fzgwyiqj2vPK wZJaykbdGsa66ufyhlmSlvm61gFIGXvE6jWlj2pEBeLLUmBBReoFNJCxSVzGYhgvMicF fF3k0SRPehBf1pUc0a+Ry+Mi9sOp658AjkAfZFhEQq3OS6CzYiW5PaBHz8kaLKY4otmJ e2z8Jv9WvRJTO3+MRgcFkk+BQpDlaX7NO6RYrzWOHAWrTj/pbl33HweETIhMhnphIwFN /Q6TBjtgX/gah9kD9lInhhuV7kwdR0uiGgX+Stme8yOP8SF4m1hD1QleHytW2IZv+f2U jiuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lo3si2000419ejb.686.2021.01.21.09.24.12; Thu, 21 Jan 2021 09:24:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388266AbhAURWT (ORCPT + 99 others); Thu, 21 Jan 2021 12:22:19 -0500 Received: from mx2.suse.de ([195.135.220.15]:43294 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388036AbhAURWD (ORCPT ); Thu, 21 Jan 2021 12:22:03 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 78005ABD6; Thu, 21 Jan 2021 17:21:19 +0000 (UTC) Subject: Re: SLUB: percpu partial object count is highly inaccurate, causing some memory wastage and maybe also worse tail latencies? To: Jann Horn , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton Cc: Linux-MM , kernel list , Thomas Gleixner , Sebastian Andrzej Siewior , Roman Gushchin , Johannes Weiner , Shakeel Butt , Suren Baghdasaryan , Minchan Kim , Michal Hocko References: From: Vlastimil Babka Message-ID: Date: Thu, 21 Jan 2021 18:21:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/12/21 12:12 AM, Jann Horn wrote: > At first I thought that this wasn't a significant issue because SLUB > has a reclaim path that can trim the percpu partial lists; but as it > turns out, that reclaim path is not actually wired up to the page > allocator's reclaim logic. The SLUB reclaim stuff is only triggered by > (very rare) subsystem-specific calls into SLUB for specific slabs and > by sysfs entries. So in userland processes will OOM even if SLUB still > has megabytes of entirely unused pages lying around. > > It might be a good idea to figure out whether it is possible to > efficiently keep track of a more accurate count of the free objects on > percpu partial lists; and if not, maybe change the accounting to > explicitly track the number of partial pages, and use limits that are > more appropriate for that? And perhaps the page allocator reclaim path > should also occasionally rip unused pages out of the percpu partial > lists? I'm gonna send a RFC that adds a proper shrinker and thus connects this shrinking to page reclaim, as a reply to this e-mail.