Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1789341rwl; Fri, 31 Mar 2023 17:21:34 -0700 (PDT) X-Google-Smtp-Source: AKy350alxMplBT4w+mvBm/RZORKcA820C8tMnbDYSdfL7Xa4U7cs80ky7MmGK223DhOvOzbhC0gF X-Received: by 2002:a17:906:297:b0:932:170:e07b with SMTP id 23-20020a170906029700b009320170e07bmr5783987ejf.7.1680308494610; Fri, 31 Mar 2023 17:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680308494; cv=none; d=google.com; s=arc-20160816; b=vsqBdbnhBmze2Ifpy+l0yeAINMCKnTnhv7iHnyrD5Hnx94qZmAiYS5hN30SYyjUoa7 KY8xYQhFpwAbrU7RnthqBha2PGuUffU6wof6JxXAxdqs8v2TurEwj76ncPeJC+CArIFz /JgqQTyUc8i61L5if8o+k8g2o9x5awUDgloX/wiYguyyypX51sbIYUY0zWtqXr9Z2aP9 SzcgfLvTrBqUozrW8xYpFqQjUJvVubozcOgrm1NBGuHND3MjHYHE/qAVTchXOwZwrBAA oJEp90vWs3QkLnNt0TMjXmhCfcypAENSdjz0PaSqh0AEv6CuhhO4PKGzQ+j+R4ksOnAD qCsw== 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=Okwnr5qauASHAsEFw1/R6hIbFinf58P4KeKuOuyDC8s=; b=ftq51O694u/GN7TRgBuN+Ki+lJASL5nfbn3tKzBTxOy5sKeCqviTypaSdMk/4ZiXQn yTlBvtlF95KOspTI62+Ihs+rj4pJGKO6fcEtGguWqo+DK4YpHHHFocyDhEmi5VeQxWmU 4l9LuqLj5LjUO4FV8mP8V7s7HtMoiGB6b/XOAaDCRRFv1o3aFJUn2YrSCzgfXS1SPzGJ 4hQmIGgNJQUUNM0hKroR7irY9hJvt0jlC7BPINXWygdoJw6VhtNfDW6GQLK4PUgkjVhn ZmVW5HAbvTAgKyvpW/QgEr3XAwJ1YkygSwYl69orGsgoLbSkf2Cj977pNbwI6wNgR9X1 baOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TX46C1dQ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=IPxozgKT; 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 qx26-20020a170906fcda00b0093c09a76ac9si3221384ejb.481.2023.03.31.17.21.09; Fri, 31 Mar 2023 17:21:34 -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=TX46C1dQ; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=IPxozgKT; 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 S233383AbjDAAFG (ORCPT + 99 others); Fri, 31 Mar 2023 20:05:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233396AbjDAAFD (ORCPT ); Fri, 31 Mar 2023 20:05:03 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D595901C; Fri, 31 Mar 2023 17:04:53 -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-out1.suse.de (Postfix) with ESMTPS id 34D7021A89; Sat, 1 Apr 2023 00:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680307492; 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=Okwnr5qauASHAsEFw1/R6hIbFinf58P4KeKuOuyDC8s=; b=TX46C1dQTO9lgGzXXjdlcIcH5Ny/YS1+HeVUfOdQhwsDLRIY0/SALE1KlmQSuLzluTt0b+ tS8OHlXfHGzYHNRvK8XpmexsROVUiIqLI0mZRi1W5eb/5kc4aLia9XTLnc2U4B3VzqM0ko R6yIopHQgZ8uGD5Z9CDvVvsuwabKBsU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680307492; 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=Okwnr5qauASHAsEFw1/R6hIbFinf58P4KeKuOuyDC8s=; b=IPxozgKTw3NH//wQSo1bSnKWB+qf5WXWBFVe4DUVTpiVZaDhx8wRwKG+BbydGQMLJJG9yq +8OUIRaAmDVtRNAA== 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 A4B43134FB; Sat, 1 Apr 2023 00:04:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Ok/EGyN1J2RHZQAAMHmgww (envelope-from ); Sat, 01 Apr 2023 00:04:51 +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> Date: Fri, 31 Mar 2023 21:04:48 -0300 In-Reply-To: <6eaadad2-d6a6-dfbb-88aa-8ae68af2f89d@gmail.com> (Pavel Begunkov's message of "Fri, 31 Mar 2023 17:27:45 +0100") Message-ID: <87wn2wzcv3.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 3/31/23 15:09, Gabriel Krisman Bertazi wrote: >> Pavel Begunkov writes: >> >>> Add allocation cache for struct io_rsrc_node, it's always allocated and >>> put under ->uring_lock, so it doesn't need any extra synchronisation >>> around caches. >> Hi Pavel, >> I'm curious if you considered using kmem_cache instead of the custom >> cache for this case? I'm wondering if this provokes visible difference in >> performance in your benchmark. > > 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? kmem_cache works fine for most hot paths of the kernel. I think this custom cache makes sense for the request cache, where objects are allocated at an incredibly high rate. but is this level of update frequency a valid use case here? 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! -- Gabriel Krisman Bertazi