Received: by 10.192.165.156 with SMTP id m28csp412919imm; Tue, 17 Apr 2018 12:17:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ulLUJdOoQbvFFTSieag0dTCd4LQ4jngaCua2vLkp+B2t+073TpWUz7aAe20JqGlQW+lfh X-Received: by 2002:a17:902:b68e:: with SMTP id c14-v6mr3180892pls.286.1523992654856; Tue, 17 Apr 2018 12:17:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523992654; cv=none; d=google.com; s=arc-20160816; b=uu0jEVrEZkq/HNJKlxR4Y90vhMzfAfrH1+ge5BPlFB5K8wiXa7bc+tQJXZz/zxRvxY uCxmG0a0QfZ1ZelpcTu7xIIdCejEWq6UGq7o7HASrLSg2iJMXx+tzu5AbbeME/bo2GW7 OszJGufu79C2Hz5ThDHmtspcz9GhzLWt258PcNq2KwG6Uiey7B7m7Zum3RZ5WJNEyjne abwXJWFMGC/vEbS1r0LU090+/RttMB7XsxYr49MEOpi7rFhyPjl8WSdZkgX61npp8tgy hVU/owPsM2ju1b7/5aBg5AhJdospnEAuQ2nRGDLMN7Polkr6JuVYlc4k6d+Rt6XLaqz0 jMfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=+lF9EcoyHRyHeulXZKtjB7iOmMzjLWSVAkobip6XEMU=; b=fcbm/6yNQOzsa2R48rf4qzIAyB/oTS++acrj44OkOliFlkPEcbcnhNkknjLBZU4/hr vUDs/1S78imFJaK0St4ExHZYOLsDWKJsdrDkobRY5wllT1Q/7oBRIiAP4JjEnQja5xqA 02mha9rlaUyhJdlrxXV9pOIxoIizeD/IXOrVjL2+BziZ5Eq1Z5M2+g7mpsqG86Gdj7Mr ZF+wsUnT+xwLMRf/1fwU1wWakDjGxvRB/csF9BY+SgdQ0075xQIb0M+hufMEqgWqecOg cobSkdI9z7m5JRfq/RKnlZGHMkdCin+MCU7QFIMjxYJZdKD2hwTlBOXYtN1CixK8p5GQ xPjQ== 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 a64si11449225pgc.265.2018.04.17.12.17.21; Tue, 17 Apr 2018 12:17:34 -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 S1752709AbeDQTP4 (ORCPT + 99 others); Tue, 17 Apr 2018 15:15:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:52397 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752651AbeDQTPw (ORCPT ); Tue, 17 Apr 2018 15:15:52 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 48929AF62; Tue, 17 Apr 2018 19:15:51 +0000 (UTC) Subject: Re: [PATCH RESEND] slab: introduce the flag SLAB_MINIMIZE_WASTE To: Mikulas Patocka Cc: Christopher Lameter , Mike Snitzer , Matthew Wilcox , Pekka Enberg , linux-mm@kvack.org, dm-devel@redhat.com, David Rientjes , Joonsoo Kim , Andrew Morton , linux-kernel@vger.kernel.org References: <20c58a03-90a8-7e75-5fc7-856facfb6c8a@suse.cz> <20180413151019.GA5660@redhat.com> <20180416142703.GA22422@redhat.com> <20180416144638.GA22484@redhat.com> From: Vlastimil Babka Message-ID: <8ab1e75f-9cf9-2a99-d071-c8c7a3554b95@suse.cz> Date: Tue, 17 Apr 2018 21:13:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/17/2018 07:26 PM, Mikulas Patocka wrote: > > > On Tue, 17 Apr 2018, Vlastimil Babka wrote: > >> On 04/17/2018 04:45 PM, Christopher Lameter wrote: >>> On Mon, 16 Apr 2018, Mikulas Patocka wrote: >>> >>>> This patch introduces a flag SLAB_MINIMIZE_WASTE for slab and slub. This >>>> flag causes allocation of larger slab caches in order to minimize wasted >>>> space. >>>> >>>> This is needed because we want to use dm-bufio for deduplication index and >>>> there are existing installations with non-power-of-two block sizes (such >>>> as 640KB). The performance of the whole solution depends on efficient >>>> memory use, so we must waste as little memory as possible. >>> >>> Hmmm. Can we come up with a generic solution instead? >> >> Yes please. >> >>> This may mean relaxing the enforcement of the allocation max order a bit >>> so that we can get dense allocation through higher order allocs. >>> >>> But then higher order allocs are generally seen as problematic. >> >> I think in this case they are better than wasting/fragmenting 384kB for >> 640kB object. > > Wasting 37% of memory is still better than the kernel randomly returning > -ENOMEM when higher-order allocation fails. Of course, see below. >>> That >>> means that callers need to be able to tolerate failures. >> >> Is it any different from now? I suppose there would still be >> smallest-order fallback involved in sl*b itself? And if your allocation ^ There: "I suppose there would still be smallest-order fallback involved in sl*b itself?" If SLAB doesn't currently support fallback to different order, it either learns to do that, or keeps wasting memory and more people will migrate to SLUB. Simple.