Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4369982pxb; Tue, 5 Oct 2021 01:23:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye3AjgxkeDQP2cIx41Fb+OTEdGa90mNI1d1r39AsKrO1OdMMgXUg7v1hUxAlV5u9YL3gmf X-Received: by 2002:a17:907:f83:: with SMTP id kb3mr22921897ejc.453.1633422214041; Tue, 05 Oct 2021 01:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633422214; cv=none; d=google.com; s=arc-20160816; b=qfM3+VKvYPi0xJuDWNdaHB5PMjTo7rE9hT3riwY8ih3TwYzEiNZY3dQuw/sDxa8Jfp oO4xgBXF2ORoKIVFbdLQfLlXDMndVOBsXL0mjl4gAMrVdTYI2JXJuDE6uCf6sUgt+wL2 Gut/NaUuPekVNTlknMgVlmFObxWM70QuFdtdpMkI0GGHgdDsfo1IgysfhKzU5iJATS7V x7aduDIL5tUfHeycumdEDeogzdxpbX5481WL2ozxGJWM7jRqnDBxaX9U2w/efGydYRYi TbeEFlL7ksmhrA9hLL/qLb2ROX/jqUl0LZvdI0zekf2Y4XK3TzxiaQEGnvDckfPWer/c PMMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=hNwtCpdH8x2CNs+9d+1b7WmfBaR40WkJXzrsENFs2vM=; b=cXZ60HqVDtJaeZv1FPkz8iwnHGO6C208LmhvfMzhdsRnKHYwGiJR1ynRrbhkR6cC4u ScgPJahRutokf6cAN4uEbhlDtieoAOmrIHJa6OxfsPkdR+A2m8eH4CtvP01o4YLIhBbI 47KqIr7DGlUp8E8DvyKroq0iKXxImPnMs5s/KGaghtjir1WM+ZWj+qOJytmpmxsgXolR Hn6nDoeQ6gibPeO1jJtmFRzkuli1mBCW6klSPeoFYOr/SeafvWTfqwh+uuC5ecIBmboS su685tizlVQhCEnMdRCzxihSCDk0XT17RebTFyPAY5Bp/ZdkbwdNc2DC2yxCXHdAafBm ZwlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=zAGJFrmv; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=V0qXyZbu; 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 e7si25728567edk.96.2021.10.05.01.23.08; Tue, 05 Oct 2021 01:23:34 -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=@suse.cz header.s=susede2_rsa header.b=zAGJFrmv; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=V0qXyZbu; 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 S232365AbhJEIVZ (ORCPT + 99 others); Tue, 5 Oct 2021 04:21:25 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:49628 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233367AbhJEIVY (ORCPT ); Tue, 5 Oct 2021 04:21:24 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 840E221BCF; Tue, 5 Oct 2021 08:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1633421972; h=from:from:reply-to: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; bh=hNwtCpdH8x2CNs+9d+1b7WmfBaR40WkJXzrsENFs2vM=; b=zAGJFrmv1FOiyXoFqNB0ypj1Y3YTOhyuVNz7C4UHlMtew8JEa0+P71+bV//pWqvlGQt988 Fsmt9GPgEJ3OSZn5+JRgtFFeRUfrC9+U64Zcr8y+8I/W+nLUQ6BfPO5sFH3oX/8vdsMROQ ebR1BILzeHWQ68d7r1Un0dbUM9gn5cc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1633421972; h=from:from:reply-to: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; bh=hNwtCpdH8x2CNs+9d+1b7WmfBaR40WkJXzrsENFs2vM=; b=V0qXyZbuxwcXCTo6US79LggLmLKiA8/mOtGFypTLwltDGuE1xBO3iZOZeq98jXhkJ3RTtr TA6QYATx2OJVnIBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6093B13A78; Tue, 5 Oct 2021 08:19:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6iTIFpQKXGE/YQAAMHmgww (envelope-from ); Tue, 05 Oct 2021 08:19:32 +0000 Message-ID: <09ca489a-ecfb-dd5e-b057-dc9c59c8585e@suse.cz> Date: Tue, 5 Oct 2021 10:19:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Content-Language: en-US To: Christoph Lameter , Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: linux-mm@kvack.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-kernel@vger.kernel.org References: <20210927090347.GA2533@linux.asia-northeast3-a.c.our-ratio-313919.internal> <8aa15f4b-71de-5283-5ebc-d8d1a323473d@suse.cz> <20211001003908.GA2657@linux.asia-northeast3-a.c.our-ratio-313919.internal> From: Vlastimil Babka Subject: Re: Queueing is outside of SLUB nowdays In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/4/21 16:56, Christoph Lameter wrote: > On Fri, 1 Oct 2021, Hyeonggon Yoo wrote: > >> Looking at other layers, they implemented queuing layer outside of SLUB. >> See commit 795bb1c00dd ("net: bulk free infrastructure for NAPI context, >> use napi_consume_skb") for example. They made skb cache because SLUB is >> not suitable for intensive alloc/free. >> >> And because the queue is outside of slab, it can go lockless >> depending on it's context. (But it's not easy to do so in slab because >> slab is general purpose allocator.) > > The queuing within in SLUB/SLAB is lockless. > >> So current approach on place where slab's performance is critical >> is implementing queuing layer on top of slab. > > If you have to use object specific characteristics to optimize then yes > you can optimize further. However, the slab allocators implement each > their own form of queuing that is generic. > >> Then new question arising: >> - Is that proper way to solve fundamental problem? > > There is a problem? If someone benefits from implementing a caching layer on top of SL*B, it probably indicates a problem. >> - why not use SLAB if they need queuing? > > SLAB is LIFO queuing whereas SLUB uses spatial considerations and queues > within a page before going outside. IIUC SLUB queueing works well for allocation (we just consume a per-cpu freelist that nobody else can touch) but freeing uses the corresponding page's freelist so the atomics are more expensive. In both cases the linked freelists might be also worse for cache locality than an array of pointers. So perhaps some workload still benefit from a array-based cache on top of SLUB and it would be great if they didn't have to implement own solutions? > Slab requires disabling interrupts, > SLUB is optimized to rely on per cpu atomics and there are numerous other > differences. > >> - how does this approach work on SLAB? > > SLAB has a lockless layer that is only requiring disabling interrupts. It > provides a generic queuing layer as well. > > See my talk on Slab allocators awhile back. > > https://www.youtube.com/watch?v=h0VMLXavx30 >