Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3979310yba; Wed, 17 Apr 2019 01:51:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvs5IDxINWckLoeUVokBUEwAqPj4sadeJ/CdhvGOFXuepg22fVDF31ThJkIwZx3k4eD89d X-Received: by 2002:a17:902:2d01:: with SMTP id o1mr88417326plb.155.1555491117570; Wed, 17 Apr 2019 01:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555491117; cv=none; d=google.com; s=arc-20160816; b=NRdjPRRuGBJOE+B2OhbPtpHM3Bhd1qoOCxREUOo+AS1FOJf1TX1WRRZcZzcKYgac+O RllCqobqQZ3RbGv4jbkwuOWr7jsdrvMxBtNdIZEsR7UJDJ6ICxK9+gBSTHedl4fc93V4 C3kHj1ioRPZuf5lfbGoI4WCKoDDcRw8KCzELgImV/pT6mlaPYXPEsblA6HjLOh7B4kEc 90BGYGxhPmvcLlIk7+17+v3aha8cvkQ2IdQKGrFplYE2caMkqknTBe/1BYyJJb5VkEnj q/VW7W4fcaocqU02IbJvCAPbCc8zmD6c7sU/wWTfjaG/Uo7XY1ouYayK7htkETVhOTjI CPpQ== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=qnWCBlM9SFBUmDRR+A8TsvVH6yTv02dm2O49KOiT/Vg=; b=HEp6CeAkCwmpYQtec/i/HD4kAs84KKzAijIH+iCyvEPyj7Xfld7rfDnHBFibyzJhyO nHuhFtC5Fi6HSH4rz59uG8L8xBI9gMt0IzQJ2RnAxPagU7x35cURGWfcu1BMSox6Nsz+ FNWqMtqL39KdcZYwKzXQpcp63iSxownZ2pRqfyvmgQ9u3U+4ZhIyEAndt74ajGGT45Hj ERy6Zrk1KPShQCbYLyFudwC/9DiDk9irL1DDzlPI0OeIFSQUm/qJS4K4ZcfLzTcOXOY0 5pZ5kHQDG2Iv8hDNIWrGE+29ivTG+XAmHbK/Gc30zPOo1Koi9iY6GoSVZMwBIlZKcBV0 8OSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brouer-com.20150623.gappssmtp.com header.s=20150623 header.b="v/hGZ1f5"; 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 q1si12310943plb.257.2019.04.17.01.51.42; Wed, 17 Apr 2019 01:51:57 -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; dkim=pass header.i=@brouer-com.20150623.gappssmtp.com header.s=20150623 header.b="v/hGZ1f5"; 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 S1731390AbfDQIu0 (ORCPT + 99 others); Wed, 17 Apr 2019 04:50:26 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38640 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731077AbfDQIuZ (ORCPT ); Wed, 17 Apr 2019 04:50:25 -0400 Received: by mail-lj1-f193.google.com with SMTP id p14so21681211ljg.5 for ; Wed, 17 Apr 2019 01:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brouer-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=qnWCBlM9SFBUmDRR+A8TsvVH6yTv02dm2O49KOiT/Vg=; b=v/hGZ1f53eTD32V2VFQhFuLi5dQw5P/ejWYxs7PYgiTLsS2k6X+2urxmVU7xYoikJp naKK/s4iAO2FWjzKybTXloRELpOhUkqNfWKqMOCWVKJ7ytZ1kSvHhBxQGgMFUNfpVyLN B0/SwwcNB3wqc6iAiCPK85wwjM90ZndT8zG7hLbaYb0oV8Hti9OgMO7g8hIQWgFN6nDV vzyCmeJWYj2kZ0ptumLh04qyYOuoIqJFlaneyNHpevTNGWXzG+lA8TorOFJTuLKexmGu 3UIYmul2GyvyWkyp+n4ng78FNtIVULvvHqsOJy4Nzjk/GUwnyq/KsfCyWaUxGxLFbQ2d r6nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=qnWCBlM9SFBUmDRR+A8TsvVH6yTv02dm2O49KOiT/Vg=; b=gBM90XzRwlM98FC4MPMCGYuME/mOccH/7ChD7hQg6snoIYO2pP3cqCtm8LsXudnZWq Q1iCaOIHI3gaZTZZfWK4CFrt4CYJunW9PDtiKYIbmHGtJy5bs2GlajdmFHHBnifp25x+ aMBObdU5JVDHqh+3e+NwzI7T9iIqP9fqcsJhk7REJL6o1VLCSC/7m6lEz/SVLmau3la6 JG3uqHTNdb5DF22Vpn4f1XPvTQMd5+++1xFqGWWQ1KvmdnV8ZYAmdMJy+OwlgAEKgX7E bvAUJIUVuDKOP/a0IcElpNDOY7iHqTa+QgFqG9dei4LRtqllccK1mqQTQNzFSz4R4QtG Jx2Q== X-Gm-Message-State: APjAAAW/JLUCz/rX4Y6A92Qj2q4swn5QBnxAOORrUN7BkQvqpFWjvCEF p5HpYD1b7T5/Qh+QS4AAPJJ/Sg== X-Received: by 2002:a2e:9719:: with SMTP id r25mr6784693lji.29.1555491023092; Wed, 17 Apr 2019 01:50:23 -0700 (PDT) Received: from carbon (80-167-222-154-cable.dk.customer.tdc.net. [80.167.222.154]) by smtp.gmail.com with ESMTPSA id v4sm7754208ljh.40.2019.04.17.01.50.21 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 17 Apr 2019 01:50:22 -0700 (PDT) Date: Wed, 17 Apr 2019 10:50:18 +0200 From: Jesper Dangaard Brouer To: Pekka Enberg Cc: Michal Hocko , "Tobin C. Harding" , Vlastimil Babka , "Tobin C. Harding" , Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Tejun Heo , Qian Cai , Linus Torvalds , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mel Gorman , "netdev@vger.kernel.org" , Alexander Duyck Subject: Re: [PATCH 0/1] mm: Remove the SLAB allocator Message-ID: <20190417105018.78604ad8@carbon> In-Reply-To: <262df687-c934-b3e2-1d5f-548e8a8acb74@iki.fi> References: <20190410024714.26607-1-tobin@kernel.org> <20190410081618.GA25494@eros.localdomain> <20190411075556.GO10383@dhcp22.suse.cz> <262df687-c934-b3e2-1d5f-548e8a8acb74@iki.fi> Organization: Red Hat Inc. X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 Apr 2019 11:27:26 +0300 Pekka Enberg wrote: > Hi, > > On 4/11/19 10:55 AM, Michal Hocko wrote: > > Please please have it more rigorous then what happened when SLUB was > > forced to become a default > > This is the hard part. > > Even if you are able to show that SLUB is as fast as SLAB for all the > benchmarks you run, there's bound to be that one workload where SLUB > regresses. You will then have people complaining about that (rightly so) > and you're again stuck with two allocators. > > To move forward, I think we should look at possible *pathological* cases > where we think SLAB might have an advantage. For example, SLUB had much > more difficulties with remote CPU frees than SLAB. Now I don't know if > this is the case, but it should be easy to construct a synthetic > benchmark to measure this. I do think SLUB have a number of pathological cases where SLAB is faster. If was significantly more difficult to get good bulk-free performance for SLUB. SLUB is only fast as long as objects belong to the same page. To get good bulk-free performance if objects are "mixed", I coded this[1] way-too-complex fast-path code to counter act this (joined work with Alex Duyck). [1] https://github.com/torvalds/linux/blob/v5.1-rc5/mm/slub.c#L3033-L3113 > For example, have a userspace process that does networking, which is > often memory allocation intensive, so that we know that SKBs traverse > between CPUs. You can do this by making sure that the NIC queues are > mapped to CPU N (so that network softirqs have to run on that CPU) but > the process is pinned to CPU M. If someone want to test this with SKBs then be-aware that we netdev-guys have a number of optimizations where we try to counter act this. (As minimum disable TSO and GRO). It might also be possible for people to get inspired by and adapt the micro benchmarking[2] kernel modules that I wrote when developing the SLUB and SLAB optimizations: [2] https://github.com/netoptimizer/prototype-kernel/tree/master/kernel/mm > It's, of course, worth thinking about other pathological cases too. > Workloads that cause large allocations is one. Workloads that cause lots > of slab cache shrinking is another. I also worry about long uptimes when SLUB objects/pages gets too fragmented... as I said SLUB is only efficient when objects are returned to the same page, while SLAB is not. I did a comparison of bulk FREE performance here (where SLAB is slightly faster): Commit ca257195511d ("mm: new API kfree_bulk() for SLAB+SLUB allocators") [3] https://git.kernel.org/torvalds/c/ca257195511d You might also notice how simple the SLAB code is: Commit e6cdb58d1c83 ("slab: implement bulk free in SLAB allocator") [4] https://git.kernel.org/torvalds/c/e6cdb58d1c83 -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer