Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6186558rwl; Tue, 4 Apr 2023 09:00:28 -0700 (PDT) X-Google-Smtp-Source: AKy350bhHVpE8a+lSnH8fxBGaENb4Y/5JiZQNww+TwnDEyyVk7+ZPOVFq/ucMCNBKTaDhNyYiVDr X-Received: by 2002:a17:907:20fb:b0:932:51a0:ceaa with SMTP id rh27-20020a17090720fb00b0093251a0ceaamr2742593ejb.77.1680624028561; Tue, 04 Apr 2023 09:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680624028; cv=none; d=google.com; s=arc-20160816; b=GCjxjQYZ2dtqa5v/Uqp4QIID8yTAqfkMeQrrKztLkxNzjmSRLL4NWGcp4a5EI2UA3m 3U2848rXXZ9FZ4UUUKSzxfTGaLoPeV6kdmnmqWAZDOCNM6rQNiYL3n+M3YZGGbFmHBC/ jyIhVvlDI4jqw4rD1X4/WlgUxKyTMQJoPvSarAEO69e2cmNuUq97FkOtnd0fBx9sDGlE h4gjOiE0VIRTYWBiQM9KW7fpDM6O8SEJVHDgngL9zeJ6S9uyLIHESe+UjiENDvipEo3t yGbALAodZqmqUCUEH2d/crllLlJNEHLpLWw8JUJqOa2K2K+4wuNgKeNf5dgAAfvx2Aq0 KaUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:organization:subject:cc:to:from:dkim-signature :dkim-signature; bh=HGw5LrR+1O1OLVrcrhC6gXtzTME++X55P6opcObz7ng=; b=stgbnWUzchb4wvxaJT47+Vza0abp6IeR1rD26uf0UdQ0GLbgQC8+taUForTLGgLqi2 S+7vUBCJxhoAXcvnCXHwGzcgKFgoMsgowsGbaIZ/aKC9bYUC0tF492+9832MP8ryV3yG E9vY5VLt5UYa4/chUZfGaatQozWqet4jiFKXBxon0Q5qu7tEa/JUI4tK0+L1Aj6qZAev TxY8U6PfmgvmTtq++/HFcfw86YohcVasw2uiEjrT6i6aolMRQUwpA7QOz+ak+qmo6vb9 1PUHvsajg68drb+QOnRAJntQYkMXGtMWwettCHAK8s/AXh8C8mvDg475+G3DAaawCOCp lIxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=emRAHFwN; dkim=neutral (no key) header.i=@suse.de header.b=zWuV2MiM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a170906559600b0093e18eb2c07si880012ejp.227.2023.04.04.09.00.03; Tue, 04 Apr 2023 09:00:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=emRAHFwN; dkim=neutral (no key) header.i=@suse.de header.b=zWuV2MiM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235720AbjDDPso (ORCPT + 99 others); Tue, 4 Apr 2023 11:48:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233030AbjDDPsg (ORCPT ); Tue, 4 Apr 2023 11:48:36 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFE6CEC; Tue, 4 Apr 2023 08:48:35 -0700 (PDT) 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-out2.suse.de (Postfix) with ESMTPS id 7EC1E20109; Tue, 4 Apr 2023 15:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680623314; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HGw5LrR+1O1OLVrcrhC6gXtzTME++X55P6opcObz7ng=; b=emRAHFwNtsMVrNM56B7CzCQhpG4ZIuqnIE6yvWbpi+IAImCY3dS9WmOhVQHzoX0t8p1Im9 aWL8NAh1uGdcYXsceZ2AW1XhxfHGGAWQr+D2tc/40m0VWV0k0sbBBPAl7DFgzcCQ+kPG6T VHQfQRMBYPg+bVogBaLh0htYdOqVOKI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680623314; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HGw5LrR+1O1OLVrcrhC6gXtzTME++X55P6opcObz7ng=; b=zWuV2MiM+ox80WN8juSTEwLMflJTFQxpXHDxmKuPkfj3fGuS41yQ30AKFlDtq4lsrEDs4R 71OKrEW6wZAG7iAA== 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 EFE0B1391A; Tue, 4 Apr 2023 15:48:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id F2MbK9FGLGSlEQAAMHmgww (envelope-from ); Tue, 04 Apr 2023 15:48:33 +0000 From: Gabriel Krisman Bertazi To: Pavel Begunkov Cc: io-uring@vger.kernel.org, Jens Axboe , linux-kernel@vger.kernel.org Subject: Re: [PATCH 10/11] io_uring/rsrc: cache struct io_rsrc_node Organization: SUSE References: <7f5eb1b89e8dcf93739607c79bbf7aec1784cbbe.1680187408.git.asml.silence@gmail.com> <87cz4p1083.fsf@suse.de> <6eaadad2-d6a6-dfbb-88aa-8ae68af2f89d@gmail.com> <87wn2wzcv3.fsf@suse.de> <4cc86e76-46b7-09ce-65f9-cd27ffe4b26e@gmail.com> Date: Tue, 04 Apr 2023 12:48:31 -0300 In-Reply-To: <4cc86e76-46b7-09ce-65f9-cd27ffe4b26e@gmail.com> (Pavel Begunkov's message of "Tue, 4 Apr 2023 14:21:41 +0100") Message-ID: <87h6tvzm0g.fsf@suse.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pavel Begunkov writes: > On 4/1/23 01:04, Gabriel Krisman Bertazi wrote: >> Pavel Begunkov writes: >>> I didn't try it, but kmem_cache vs kmalloc, IIRC, doesn't bring us >>> much, definitely doesn't spare from locking, and the overhead >>> definitely wasn't satisfactory for requests before. >> There is no locks in the fast path of slub, as far as I know. it has >> a >> per-cpu cache that is refilled once empty, quite similar to the fastpath >> of this cache. I imagine the performance hit in slub comes from the >> barrier and atomic operations? > > Yeah, I mean all kinds of synchronisation. And I don't think > that's the main offender here, the test is single threaded without > contention and the system was mostly idle. > >> kmem_cache works fine for most hot paths of the kernel. I think this > > It doesn't for io_uring. There are caches for the net side and now > in the block layer as well. I wouldn't say it necessarily halves > performance but definitely takes a share of CPU. Right. My point is that all these caches (block, io_uring) duplicate what the slab cache is meant to do. Since slab became a bottleneck, I'm looking at how to improve the situation on their side, to see if we can drop the caching here and in block/. >> If it is indeed a significant performance improvement, I guess it is >> fine to have another user of the cache. But I'd be curious to know how >> much of the performance improvement you mentioned in the cover letter is >> due to this patch! > > It was definitely sticking out in profiles, 5-10% of cycles, maybe > more That's surprisingly high. Hopefully we will can avoid this caching soon. For now, feel free to add to this patch: Reviewed-by: Gabriel Krisman Bertazi -- Gabriel Krisman Bertazi