From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45917C433FE for ; Wed, 9 Nov 2022 23:00:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61D3C8E0001; Wed, 9 Nov 2022 18:00:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CD4E6B0073; Wed, 9 Nov 2022 18:00:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 470208E0001; Wed, 9 Nov 2022 18:00:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 382626B0072 for ; Wed, 9 Nov 2022 18:00:55 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id ECBA01213FF for ; Wed, 9 Nov 2022 23:00:54 +0000 (UTC) X-FDA: 80115425628.08.2599531 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 112BE4000B for ; Wed, 9 Nov 2022 23:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1668034853; x=1699570853; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=+OovEAf12y9Fz1WE3tu8W4ZvEc94J8OydV/Ckp1pyWo=; b=SeQzwhgRrXqpT/OVHWxo1nbVM9VuOnUFlVQAjrc4l9POEjTxJZXbGi1M mWKYb4DTg/NzM2H0Ug3gaqjL53wjP8dVxLWS994rScJmncK0W+t9/mf/6 OBMbn/oeNMXSUJRl/H3tacT3Fe6NPKrOV20AN46bw7XnH7uB+xuxC5Meg oxheF0avqyiBgExT8uiIn10lH9xRMciB2tC/f0DxwiW5BW8HyGT7ogYwO vX6RQ+6Exy0yvtf/42cFQUYR7HxFScXTeWdZynz3ERFBJX5IwRfXY8XU5 lHz5cWSpGbLG7PVXEealMQX9Nx/vulGw4R73nuQ/JNDVQ+Sm02EAyDsP1 Q==; X-IronPort-AV: E=Sophos;i="5.96,152,1665417600"; d="scan'208";a="320238908" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 10 Nov 2022 07:00:48 +0800 IronPort-SDR: n/r0iTSo0inPnX/21TrwKs+gkQJoEaC/ahbscVxVrZEesTfGnYqG10loRBa39oDj6FDTQWBZsh nqEKLEf/ojDdzPWK6nPaeto8IVP5dEL6sSmYQz5T1yiytNDjPYnGX4Xt6CAIHjdwRXrVG955sY t2/O34Oo0bSmLlnTWXc9T/mwLij5rXVQzJn1ooTI/awMKkMbkvDVS2OZ3ff+jqzet4M+UFL3e7 03qLsPxxojCgcH1aZOuRf/LNoDgP8QheD0Zq0HMYZAwkITZw0CzgfFwfQNm4rB8svAjPTRR1Jx 40I= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Nov 2022 14:19:52 -0800 IronPort-SDR: ouXsuBSa1hCQbAdCfMRUGqjImekyKrWWQPggS0ay6s6zfEoAnacOkqyv3M8QE/dUEB2k61YQsQ Br9tRZtvv+N4I/8TuzMqSMufJlOynf0F1PvvpZfD8/Vo3rbXSEF3eg9YhbBjMQgKQjYzhOOZkQ kXO1U1MC8zQlGbwxe/ntyRHHe8ZphsZnzqnRVJ3K61W0Sxr4NxEux1dNe6YmCv8iAgwToepx12 Sa5mGH0DbUHS5Nrjzgfikv3QvhNLBYuK3cM2Z+amibUVkTcvAfV0cNvMfzpnajfgutlJyJWybQ T9I= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Nov 2022 15:00:49 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4N70nC5bK3z1RWxq for ; Wed, 9 Nov 2022 15:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1668034845; x=1670626846; bh=+OovEAf12y9Fz1WE3tu8W4ZvEc94J8OydV/ Ckp1pyWo=; b=d5LVMefkImhlC6X1M33kgnqUOVSy4OyuwgPnKssoBInc+jvQcn4 mRRuo+n6+xCwto2lCdhHGgn9/yE1IHd5m/mJCMy6AFepyMSmjVXDYGgTZMIVFXGS VnebvtXnT509frqgR5o5RXtTO65PqKMKMnNszxNhGD1yK/zDmt347VPSVP8+HPpT QlyBCEbm29bzelLyj59zv9D7RO9FSUZTVKQ5JyfjnJtOXxm6lhPKIRLEFSG9m65h h/D5FTPTb3a2PEhrIRZcz0k9S37N5XgX4y/WaiyV1tcjEDeX4xPJ2WFW2el5q+Ut CQgDEdrJAHxx+n8C3SJTFg280Co5py7YdGw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id LsEzag_7mP6u for ; Wed, 9 Nov 2022 15:00:45 -0800 (PST) Received: from [10.149.53.254] (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4N70n70Mkrz1RvLy; Wed, 9 Nov 2022 15:00:42 -0800 (PST) Message-ID: Date: Thu, 10 Nov 2022 08:00:41 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: Deprecating and removing SLOB Content-Language: en-US To: Conor.Dooley@microchip.com Cc: cl@linux.com, rientjes@google.com, iamjoonsoo.kim@lge.com, penberg@kernel.org, 42.hyeyoo@gmail.com, willy@infradead.org, roman.gushchin@linux.dev, pasha.tatashin@soleen.com, torvalds@linux-foundation.org, linux-mm@kvack.org, vbabka@suse.cz, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, rkovhaev@gmail.com, akpm@linux-foundation.org References: From: Damien Le Moal Organization: Western Digital Research In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668034853; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iNS+iQe8ffftL1NJvv2XcghZa9mYG9sqdDxY7RFEAxo=; b=cRu9bb8CQVeTVFw16xTu3Dc2MMDEAyQc5gUz4bzPqG8a6/md8S/1tnawYHVcwnsLIjGAI6 tnYf9qpVch8AKeE2bc9QQzxCaw+SBfnkisVl73/3BfuEqXZqdevPTTHK5G/9uo99UA2FwL 3F50YMB92+GiA7c2t6QJbllTSwIy9Os= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none ("invalid DKIM record") header.d=wdc.com header.s=dkim.wdc.com header.b=SeQzwhgR; dkim=pass header.d=opensource.wdc.com header.s=dkim header.b=d5LVMefk; spf=pass (imf07.hostedemail.com: domain of "prvs=3057d1861=damien.lemoal@opensource.wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=3057d1861=damien.lemoal@opensource.wdc.com"; dmarc=pass (policy=quarantine) header.from=opensource.wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668034853; a=rsa-sha256; cv=none; b=bj4XkKksDIoczszv5suu90fUVPdBp+CHhWo1EQV6H8otZyp/MipOTBJjkdwsf93plnVxmG egA1+di8v7udy8UKsYmYK+tjycj9d1CHZdlJyPxegx0f0xxleBCN8RLUhBZGgatqAUm3Jf 5BxowRjP03rGkmX12KQliNpNKSf4rkg= X-Rspam-User: X-Stat-Signature: gujx7kx4kwjcg4ctkmb19xzfrtnz9ax5 X-Rspamd-Queue-Id: 112BE4000B Authentication-Results: imf07.hostedemail.com; dkim=none ("invalid DKIM record") header.d=wdc.com header.s=dkim.wdc.com header.b=SeQzwhgR; dkim=pass header.d=opensource.wdc.com header.s=dkim header.b=d5LVMefk; spf=pass (imf07.hostedemail.com: domain of "prvs=3057d1861=damien.lemoal@opensource.wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=3057d1861=damien.lemoal@opensource.wdc.com"; dmarc=pass (policy=quarantine) header.from=opensource.wdc.com X-Rspamd-Server: rspam02 X-HE-Tag: 1668034852-405033 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/10/22 02:57, Conor.Dooley@microchip.com wrote: > +CC Damien > >> There are some devices with configs where SLOB is enabled by default. >> Perhaps, the owners/maintainers of those devices/configs should be >> included into this thread: >> >> tatashin@soleen:~/x/linux$ git grep SLOB=y > >> arch/riscv/configs/nommu_k210_defconfig:CONFIG_SLOB=y >> arch/riscv/configs/nommu_k210_sdcard_defconfig:CONFIG_SLOB=y >> arch/riscv/configs/nommu_virt_defconfig:CONFIG_SLOB=y > > Saw you were not added to the CC Damien & I know you don't want your > baby broken! :) I set SLOB=y for the K210 as the config help mentions it is a bit more efficient in low memory cases. I did run a few times with SLAB and it was OK, so removing slob should not be a problem. Can check again. Cheers. > > > On 08/11/2022 21:44, Pasha Tatashin wrote: >> On Tue, Nov 8, 2022 at 10:55 AM Vlastimil Babka wrote: >>> >>> Hi, >>> >>> as we all know, we currently have three slab allocators. As we discussed >>> at LPC [1], it is my hope that one of these allocators has a future, and >>> two of them do not. >>> >>> The unsurprising reasons include code maintenance burden, other features >>> compatible with only a subset of allocators (or more effort spent on the >>> features), blocking API improvements (more on that below), and my >>> inability to pronounce SLAB and SLUB in a properly distinguishable way, >>> without resorting to spelling out the letters. >>> >>> I think (but may be proven wrong) that SLOB is the easier target of the >>> two to be removed, so I'd like to focus on it first. >>> >>> I believe SLOB can be removed because: >>> >>> - AFAIK nobody really uses it? It strives for minimal memory footprint >>> by putting all objects together, which has its CPU performance costs >>> (locking, lack of percpu caching, searching for free space...). I'm not >>> aware of any "tiny linux" deployment that opts for this. For example, >>> OpenWRT seems to use SLUB and the devices these days have e.g. 128MB >>> RAM, not up to 16 MB anymore. I've heard anecdotes that the performance >>> SLOB impact is too much for those who tried. Googling for >>> "CONFIG_SLOB=y" yielded nothing useful. >> >> I am all for removing SLOB. >> >> There are some devices with configs where SLOB is enabled by default. >> Perhaps, the owners/maintainers of those devices/configs should be >> included into this thread: >> >> tatashin@soleen:~/x/linux$ git grep SLOB=y >> arch/arm/configs/clps711x_defconfig:CONFIG_SLOB=y >> arch/arm/configs/collie_defconfig:CONFIG_SLOB=y >> arch/arm/configs/multi_v4t_defconfig:CONFIG_SLOB=y >> arch/arm/configs/omap1_defconfig:CONFIG_SLOB=y >> arch/arm/configs/pxa_defconfig:CONFIG_SLOB=y >> arch/arm/configs/tct_hammer_defconfig:CONFIG_SLOB=y >> arch/arm/configs/xcep_defconfig:CONFIG_SLOB=y >> arch/openrisc/configs/or1ksim_defconfig:CONFIG_SLOB=y >> arch/openrisc/configs/simple_smp_defconfig:CONFIG_SLOB=y >> arch/riscv/configs/nommu_k210_defconfig:CONFIG_SLOB=y >> arch/riscv/configs/nommu_k210_sdcard_defconfig:CONFIG_SLOB=y >> arch/riscv/configs/nommu_virt_defconfig:CONFIG_SLOB=y >> arch/sh/configs/rsk7201_defconfig:CONFIG_SLOB=y >> arch/sh/configs/rsk7203_defconfig:CONFIG_SLOB=y >> arch/sh/configs/se7206_defconfig:CONFIG_SLOB=y >> arch/sh/configs/shmin_defconfig:CONFIG_SLOB=y >> arch/sh/configs/shx3_defconfig:CONFIG_SLOB=y >> kernel/configs/tiny.config:CONFIG_SLOB=y >> >>> >>> - Last time we discussed it [2], it seemed SLUB memory requirements can >>> be brought very close to SLOB's if needed. Of course it can never have >>> as small footprint as SLOB due to separate kmem_caches, but the >>> difference is not that significant, unless somebody still tries to use >>> Linux on very tiny systems (goes back to the previous point). >>> >>> Besides the smaller maintenance burden, removing SLOB would allow us to >>> do a useful API improvement - the ability to use kfree() for both >>> objects allocated by kmalloc() and kmem_cache_alloc(). Currently the >>> latter has to be freed by kmem_cache_free(), passing a kmem_cache >>> pointer in addition to the object pointer. With SLUB and SLAB, it is >>> however possible to use kfree() instead, as the kmalloc caches and the >>> rest of kmem_caches are the same and kfree() can lookup the kmem_cache >>> from object pointer easily for any of those. XFS has apparently did that >>> for years without anyone noticing it's broken on SLOB [3], and >>> legitimizing and expanding this would help some use cases beside XFS >>> (IIRC Matthew mentioned rcu-based freeing for example). >>> >>> However for SLOB to support kfree() on all allocations, it would need to >>> store object size of allocated objects (which it currently does only for >>> kmalloc() objects, prepending a size header to the object), but for >>> kmem_cache_alloc() allocations as well. This has been attempted in the >>> thread [3] but it bloats the memory usage, especially on architectures >>> with large ARCH_KMALLOC_MINALIGN, where the prepended header basically >>> has to occupy the whole ARCH_KMALLOC_MINALIGN block to be DMA safe. >>> There are ongoing efforts to reduce this minalign, but the memory >>> footprint would still increase, going against the purpose of SLOB, so >>> again it would be easier if we could just remove it. >>> >>> So with this thread I'm interested in hearing arguments/use cases for >>> keeping SLOB. There might be obviously users of SLOB whom this >>> conversation will not reach, so I assume the eventual next step would be >>> to deprecate it in a way that those users are notified when building a >>> new kernel and can raise their voice then. Is there a good proven way >>> how to do that for a config option like this one? >>> >>> Thanks, >>> Vlastimil >>> >>> [1] https://lpc.events/event/16/contributions/1272/ - slides in the >>> slabs.pdf linked there >>> [2] >>> https://lore.kernel.org/all/20211017135708.GA8442@kvm.asia-northeast3-a.c.our-ratio-313919.internal/#t >>> [3] >>> https://lore.kernel.org/all/20210930044202.GP2361455@dread.disaster.area/ >>> >>> >>> -- Damien Le Moal Western Digital Research