Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2856022rdh; Wed, 27 Sep 2023 15:14:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGE6D3KVy3zKbvsjIb4JDIDcU0dT8PVizSPWGzvj5FblH0NxJMIO1zxUwBHJW0Og2DeRe0a X-Received: by 2002:a05:620a:31a9:b0:775:6785:3051 with SMTP id bi41-20020a05620a31a900b0077567853051mr3514397qkb.50.1695852840735; Wed, 27 Sep 2023 15:14:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695852840; cv=none; d=google.com; s=arc-20160816; b=DDU63eHZUFcz4H8n3W2nkgsLpvmbKX87v6zWbr9V1Ievj65YJJ/PJRkwrU4wvR+wk6 L27DU/Pn5Rh+sshnGowNZ5HLALcT43G9ZazzPRUKt9d2hL49upsbvTb2MElyDS5431Bd QDhCXpqHZSW81mBsxjzhSYl8NovQkvrRAftsePrm57/ZEZJSgsBKvFFMVKucDjgs9BGa tg27djbYqUjyusq4vTSVg+camX9J52khBEAwbubep4q571R+TITYNXwY9I71PBdI2NeX vZ941sQ6LjnyNApu9ptBXWz4TNv815C+Ex6CjKM2jk6TY/sQvxO2rwHc4dgS1qCPHlxV CrzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=ywgPMmVKMCF2OBsdPVyyMuS0V6hzCVtZvwuPzOBMAN8=; fh=PkSe+ZMTKdgxdJ/FEZrb2jcnM7GGXDqQMbDOxPyDz4E=; b=Ou5aWZ+516Xp/kDocjVEqFIATS5jMI7wIXhfPAqSp0DkmHYzTPfLeISiHk0yeFF4G3 hqyiXXnVUIBa9zwrGtSK+qU0Pmwvy4V0PHHg6EtVapWXb7dq95dX7QJDUr3M6tSuaER8 EloF1H2zhXtaftoxshuoTP1C+A9py9NAZiHNZF75P6BUy8dfzmk7dEBnkDKYKNYkFaGA SgAyNhYCHc+H5a9IleXrZHa3s91FLdHuX7gvB2mpvPm6eUQvNlMuTrVGJaZ2dDKXq4gS NKe9pH1q4eG+Q+q667PQOkD35zki3O4ozY0Urd3FiFAcBTE9MPLXyG7rTwc6oSyPJ+3V jaBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=gPHuSKZa; dkim=neutral (no key) header.i=@suse.de header.b="3DL/6u4H"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id f3-20020a056a00228300b0069347c30c86si1171567pfe.253.2023.09.27.15.14.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 15:14:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=gPHuSKZa; dkim=neutral (no key) header.i=@suse.de header.b="3DL/6u4H"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8306A805DC6D; Wed, 27 Sep 2023 15:12:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbjI0WMB (ORCPT + 99 others); Wed, 27 Sep 2023 18:12:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbjI0WMA (ORCPT ); Wed, 27 Sep 2023 18:12:00 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF8710A; Wed, 27 Sep 2023 15:11:59 -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 D48B81F385; Wed, 27 Sep 2023 22:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1695852717; 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=ywgPMmVKMCF2OBsdPVyyMuS0V6hzCVtZvwuPzOBMAN8=; b=gPHuSKZaHU9KAuUuuwNiDKETwxW4fWysw5JxRtY6rOTZsQZPEmfp03uV+qRS1CV/9RSbh7 nDBdV40djXBiaicQs+1X24AVauIhVYbo/Klfb2WGEDku1QOoJ97JQVBA/DqZJ8a/WDT/+L UkABx68z0TGnkWbHsHttr8yVs5La+CA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1695852717; 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=ywgPMmVKMCF2OBsdPVyyMuS0V6hzCVtZvwuPzOBMAN8=; b=3DL/6u4HVP2mdSxIrxYzOb49x4BTIzkl7HKf+hOqb0rVW9iaKRYNVu7GOxnyCSx41tGjAk I0UXzMBpX7CigVCw== 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 47D8D13479; Wed, 27 Sep 2023 22:11:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id pPumOquoFGUELgAAMHmgww (envelope-from ); Wed, 27 Sep 2023 22:11:55 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: Chuck Lever , "Dan Carpenter" Cc: kernel-janitors@vger.kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH nfsd] SQUASH 8dc9e02aed76 lib: add light-weight queuing mechanism. In-reply-to: <8e9f5845-0d9c-4d50-b2e4-5c1cd622a71c@moroto.mountain> References: <8e9f5845-0d9c-4d50-b2e4-5c1cd622a71c@moroto.mountain> Date: Thu, 28 Sep 2023 08:11:52 +1000 Message-id: <169585271242.5939.14975098525477744646@noble.neil.brown.name> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 27 Sep 2023 15:12:01 -0700 (PDT) Remove assumption that kmalloc never fails. Signed-off-by: NeilBrown --- Hi Chuck, please squash this into the relevant patch - thanks. Hi Dan, thanks for the review! NeilBrown lib/lwq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/lwq.c b/lib/lwq.c index 8a723b29b39e..57d080a4d53d 100644 --- a/lib/lwq.c +++ b/lib/lwq.c @@ -111,6 +111,8 @@ static int lwq_test(void) threads[i] = kthread_run(lwq_exercise, &q, "lwq-test-%d", i); for (i = 0; i < 100; i++) { t = kmalloc(sizeof(*t), GFP_KERNEL); + if (!t) + break; t->i = i; t->c = 0; if (lwq_enqueue(&t->n, &q)) @@ -127,7 +129,8 @@ static int lwq_test(void) printk(KERN_INFO " lwq: ... "); } t = lwq_dequeue(&q, struct tnode, n); - printk(KERN_CONT " %d(%d)", t->i, t->c); + if (t) + printk(KERN_CONT " %d(%d)", t->i, t->c); kfree(t); } printk(KERN_CONT "\n"); -- 2.42.0