Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2621214pxb; Sun, 17 Oct 2021 20:45:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwk+DVG4AaBD68JbOR4vnx1TNO52dZOiTuHzTRiOL2TpEyuW8PD+vn4qcl1qAvnzD2XINtp X-Received: by 2002:a17:90b:4f87:: with SMTP id qe7mr34236162pjb.29.1634528719415; Sun, 17 Oct 2021 20:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528719; cv=none; d=google.com; s=arc-20160816; b=gZiQsqdjw5PzYKcgbldSkUMUxt0IR4oeMAThdIJwQXsXprq45A9FvHEMiIdw3V2Cjk qMEnsdK7+XFwE1n7/jhErOfW/kp/dluxh9IbtJcHI3BVWsPiM+IAs1iRQyqaJXZFl68a h9th6OpO+KCffQdnN6prXFaV/kP902oOUNRyA6nksLABnOVueNSOYCalrfTkSw0jJy6/ o/jtrCA237rgxiZ/gguZ/7L8MB9PW7denKoOZfsXI5C1jof4Dkb18noRHzWvk6Mtv8/Y x/5CGKgMbmgXSutcDQioKnZfKzZPQ5pxi0HQl47yok2CjTEkTXynv1QtR+mc11BhOlIF 1g7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=80/t/c+UlQL/GFdmduRihZ3yN36jPN478cR6XUY8+rc=; b=MWUvb9w3ZLcEf3C3zPOBd6hUSE26fnypfhYZWqjAtyjhnvMn5lb1fqYRQDviO1gqdK 4Sec5opIAOFNYEsrkWpOr76eEjVoedAf3z2M48Cp641Is2OUWWDmabE/b3J9UxKtOz+5 z8vmEes5rhS41T4cUfDNfKFl46oNmaJ9nwUNJZBXvl3xtlzO7KKDFLfBgf/yqLKKUQMF j0ENpoWQr2rltwpRxHg1JCFm+ZIvJlrKrrgYmBzNM0H7ajoX3mrRQOUj6XSK+M5SmelS Fd0n9moA2d4TMkwG5/Fgp/lVSvN2d1YufVybCdBi/ugrMokFiszpWylVTRbtWSZUynd+ LkFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="EQf/D1wH"; 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 b18si26769974pgn.107.2021.10.17.20.45.06; Sun, 17 Oct 2021 20:45:19 -0700 (PDT) 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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="EQf/D1wH"; 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 S1343892AbhJQOmc (ORCPT + 98 others); Sun, 17 Oct 2021 10:42:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237972AbhJQOmb (ORCPT ); Sun, 17 Oct 2021 10:42:31 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D98C8C061765 for ; Sun, 17 Oct 2021 07:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=80/t/c+UlQL/GFdmduRihZ3yN36jPN478cR6XUY8+rc=; b=EQf/D1wHYBCM3t9+mrYTWvCfzX rI3KoP/nNTFqiMfBT3ddBel9BWMSfC5E3yBXi1brZgOmnxOKvjeCVywhNP79wnQPA6DTIwrj1kQqp IicM1zc1+igaX1EfXsA5lF6YNBzCtcZb4JvwPqkrjMiDoyGFn8X182ZXfVoTn4vx62lmWsurJM//o 4use1qlTTP8kK5fO+xnNNgYzs0bAoLN2a672XHjSzdF/aY+M0WU6LqbKmamlwGviQI+E5vLirNwmU EzH0Lh//jwGcFWchb7lgqENAftHA+weR0vullrovJcuH4ZpPH9wzlC/Ed63weY8l8ravGMKswcYN7 RDSd1NKA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mc7Jv-00ALY5-4T; Sun, 17 Oct 2021 14:39:34 +0000 Date: Sun, 17 Oct 2021 15:39:27 +0100 From: Matthew Wilcox To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka Subject: Re: Do we really need SLOB nowdays? Message-ID: References: <20211017042852.GA3050@kvm.asia-northeast3-a.c.our-ratio-313919.internal> <20211017133618.GA7989@kvm.asia-northeast3-a.c.our-ratio-313919.internal> <20211017135708.GA8442@kvm.asia-northeast3-a.c.our-ratio-313919.internal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211017135708.GA8442@kvm.asia-northeast3-a.c.our-ratio-313919.internal> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 17, 2021 at 01:57:08PM +0000, Hyeonggon Yoo wrote: > On Sun, Oct 17, 2021 at 01:36:18PM +0000, Hyeonggon Yoo wrote: > > On Sun, Oct 17, 2021 at 04:28:52AM +0000, Hyeonggon Yoo wrote: > > > I've been reading SLUB/SLOB code for a while. SLUB recently became > > > real time compatible by reducing its locking area. > > > > > > for now, SLUB is the only slab allocator for PREEMPT_RT because > > > it works better than SLAB on RT and SLOB uses non-deterministic method, > > > sequential fit. > > > > > > But memory usage of SLUB is too high for systems with low memory. > > > So In my local repository I made SLOB to use segregated free list > > > method, which is more more deterministic, to provide bounded latency. > > > > > > This can be done by managing list of partial pages globally > > > for every power of two sizes (8, 16, 32, ..., PAGE_SIZE) per NUMA nodes. > > > minimal allocation size is size of pointers to keep pointer of next free object > > > like SLUB. > > > > > > By making objects in same page to have same size, there's no > > > need to iterate free blocks in a page. (Also iterating pages isn't needed) > > > > > > Some cleanups and more tests (especially with NUMA/RT configs) needed, > > > but want to hear your opinion about the idea. Did not test on RT yet. > > > > > > Below is result of benchmarks and memory usage. (on !RT) > > > with 13% increase in memory usage, it's nine times faster and > > > bounded fragmentation, and importantly provides predictable execution time. > > > > > > > Hello linux-mm, I improved it and it uses lower memory > > and 9x~13x faster than original SLOB. it shows much less fragmentation > > after hackbench. > > > > Rather than managing global freelist that has power of 2 sizes, > > I made a kmem_cache to manage its own freelist (for each NUMA nodes) and > > Added support for slab merging. So It quite looks like a lightweight SLUB now. > > > > I'll send rfc patch after some testing and code cleaning. > > > > I think it is more RT-friendly becuase it's uses more deterministic > > algorithm (But lock is still shared among cpus). Any opinions for RT? > > Hi there. after some thinking, I got a new question: > If a lightweight SLUB is better than SLOB, > Do we really need SLOB nowdays? Better for what use case? SLOB is for machines with 1-16MB of RAM.