Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1215311imk; Sun, 3 Jul 2022 20:54:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vmHFCaQMfZYuvngzJgg84P3+KccdKuS1/FZsUUU6dazV8KwHiMM9SQX9qvt+GJGhTvD2av X-Received: by 2002:a17:90b:3a90:b0:1ed:27b7:5458 with SMTP id om16-20020a17090b3a9000b001ed27b75458mr32971829pjb.208.1656906854252; Sun, 03 Jul 2022 20:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656906854; cv=none; d=google.com; s=arc-20160816; b=Nif7qENgwuBC6Qwq+qQTjpZJYeB1ESjTHSmtGDsklQ1UfVY4s80f8zHd7XnUJ0z4R6 rje8B+CYYAAZDVoNT6GwDYAxUZobpbwzsIAaz3Dx+/Lles8/IJFNBx2G//OeZdUr87D0 kjXcqIr2nIf5ewnhi+ok8e7DoZPRrlrutHgxsHP0+8IZa5UqvQvFBi/tswU9tz/1puyp D16k8Z9sMf0vDxvRgH+C6qCCSQsSxMYJGilJ5XD1Wj8/HQIylDepa9Bp9i77uwWHROlC f9PZVZ6EQXa3LL8+wlZqXc/cfu6BJ0/s4mEf5zCOirHTYZOxEkBGg9ge6apyqGIzAwbm RwFQ== 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 :dkim-signature; bh=N3c1eiQ7nwJJg69WAl+jbstvA3hNmOP3XxOxF8bdAH8=; b=Xj3+0bXyt5yI+EWf0vP+PPxU0DjXW+7yzAu/xFuaqnXKCmP92rpejUraweZTOecSdJ lBxio/GfK01CZXrYZNvK0YQDINMuPmEiK/4tv5/N9hYCfpqIa1vSjz2thbUvshIi2XCl Nya7jEU15OTbF0i6qm8EWsGvdn0laWf+IlckzayiUxApC9DooiLWzvCPsLQ6gzrwNBo8 01p5SPmH/6IyZoFp92DBMb4fJ0p5MXzdwc/Sn7XyhQhdtTzEj37sGkLvIKQPa/4wJUuu J7Onm24ZVqcjq5P0UnjI3Wl2M0DXGPzGbDskpoTDI1idJeyKenZPb3r6dzYmk9iPfYKz Zxiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=pQHyggw9; dkim=pass header.i=@codewreck.org header.s=2 header.b=Cdz3gC+O; 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=codewreck.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a654644000000b003c5e1870569si43813584pgr.171.2022.07.03.20.54.01; Sun, 03 Jul 2022 20:54:14 -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=@codewreck.org header.s=2 header.b=pQHyggw9; dkim=pass header.i=@codewreck.org header.s=2 header.b=Cdz3gC+O; 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=codewreck.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230189AbiGDDjO (ORCPT + 99 others); Sun, 3 Jul 2022 23:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbiGDDjN (ORCPT ); Sun, 3 Jul 2022 23:39:13 -0400 Received: from nautica.notk.org (nautica.notk.org [91.121.71.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D24B2622 for ; Sun, 3 Jul 2022 20:39:09 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 108) id 7EC67C01D; Mon, 4 Jul 2022 05:39:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1656905947; bh=N3c1eiQ7nwJJg69WAl+jbstvA3hNmOP3XxOxF8bdAH8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pQHyggw9mrB2lFZavRFDFOp/VP1YlvOdu3KR3ya9HuVOqE5VoDCBEBnvdSZnnEmdT 1Hjzet1EBR5xuZHQaTydkH3PuZeJVApfAVID8z6eyDUTdcUemQL2QjGw+cFiwUF07T mnyAIPA6YA7T4PtMP+8WmkGUwTgiiJGI7Kj6PTHome04n4NU64Lw1pl0+H7JzXtUue BMEdMMV5BhCS8keKlvGDSGQ1MqkvrvDHBuP3NtvahmOr8FPKNC5A2hyaznh0lKnYNd +XUV7qZcYR7CumsNbI2DdAgeiMkeXHOSYibCFgxTFM8opacxnG6WC2ektQOWWrieN/ U2KepKzupIOZg== X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 0E1F4C009; Mon, 4 Jul 2022 05:39:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1656905946; bh=N3c1eiQ7nwJJg69WAl+jbstvA3hNmOP3XxOxF8bdAH8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Cdz3gC+OMwGPXDc8pOgDDCqx2HS4nAnAH46oK+3FxeA6v7z1t5Bb3yZ1//uWrfWJl A0l7SatELFmrCT7aNab73cqJXw0JAIKxgsLqR7f1DSjyfJkKGEH/1BejkXzrbGYPAB Rvoy1JWAlxT+0Wv3tnvaRgESgRhKb6tsvQhCsX7/STnyct+3W/gj8Sc4TDsfmV2D/C BkH1WtgKB9gLGjwf81jF4G2HMfw1QcKYUChMPuAYGy9jlu7CuLHMa4+jdiXltD477V gFzgUxEbDBlC0Ah2LdrHXMMArEwS2AQMCXrZNZqgA4XcAlzolEhPmJ+K6tCSzGttjm TK5LBzO1Npcww== Received: from localhost (odin.codewreck.org [local]) by odin.codewreck.org (OpenSMTPD) with ESMTPA id 8cdbb83f; Mon, 4 Jul 2022 03:39:01 +0000 (UTC) Date: Mon, 4 Jul 2022 12:38:46 +0900 From: Dominique Martinet To: Kent Overstreet , Christian Schoenebeck Cc: linux-kernel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, Eric Van Hensbergen , Latchesar Ionkov Subject: Re: [PATCH 3/3] 9p: Add mempools for RPCs Message-ID: References: <20220704010945.C230AC341C7@smtp.kernel.org> <20220704014243.153050-1-kent.overstreet@gmail.com> <20220704014243.153050-3-kent.overstreet@gmail.com> <20220704030557.fm7xecylcq4z4zkr@moria.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220704030557.fm7xecylcq4z4zkr@moria.home.lan> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Christian, sorry I just noticed you weren't in Ccs again -- the patches are currently there if you want a look: https://evilpiepirate.org/git/bcachefs.git/log/?h=9p_mempool I think it'll conflict a bit with your 8k non-read/write RPCs but I'll take care of that when checking it this weekend. Kent Overstreet wrote on Sun, Jul 03, 2022 at 11:05:57PM -0400: > > We shouldn't have any user calling with more at this point (the > > user-provided size comes from p9_client_prepare_req arguments and it's > > either msize or header size constants); and it probably makes sense to > > check and error out rather than cap it. > > If that's the case I think we should just switch the warning to a BUG_ON() - I > just wasn't sure from reading the code if that was really guarded against. yes, BUG_ON is good for me. > > > - if (p9_fcall_init(c, &req->tc, alloc_msize)) > > > + if (p9_fcall_init(c, &req->tc, 0, alloc_msize)) > > > goto free_req; > > > - if (p9_fcall_init(c, &req->rc, alloc_msize)) > > > + if (p9_fcall_init(c, &req->rc, 1, alloc_msize)) > > > > given the two rc/tc buffers are of same size I don't see the point of > > using two caches either, you could just double the min number of > > elements to the same effect? > > You can't double allocate from the same mempool, that will deadlock if multiple > threads need the last element at the same time - I should've left a comment for > that. hmm, looking at the code as long as min elements is big enough the deadlock becomes increasingly difficult to hit -- but I guess there's no guarantee we won't get 8 threads each getting their first item from the pool and starving each other on the second... Fair enough, thank you for the comment. > @@ -270,10 +276,8 @@ p9_tag_alloc(struct p9_client *c, int8_t type, unsigned int max_size) > if (!req) > return ERR_PTR(-ENOMEM); > > - if (p9_fcall_init(c, &req->tc, alloc_msize)) > - goto free_req; > - if (p9_fcall_init(c, &req->rc, alloc_msize)) > - goto free; > + p9_fcall_init(c, &req->tc, 0, alloc_msize); > + p9_fcall_init(c, &req->rc, 1, alloc_msize); mempool allocation never fails, correct? (don't think this needs a comment, just making sure here) This all looks good to me, will queue it up in my -next branch after running some tests next weekend and hopefully submit when 5.20 opens with the code making smaller allocs more common. -- Dominique