From patchwork Mon Dec 16 20:46:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13910518 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AACD81D434F for ; Mon, 16 Dec 2024 20:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734381996; cv=none; b=Q2XVFJridmjBokkNrNHNAq47hDBz2BVHX2I2qMcC1givXsCF5a+89S5Zhl0H+48NAqB2M5d2enqmgiAlerz6T8xXALUwU34X71/5/w19H/jJJdqWLC+Oh4S7jMTDp65RsSfAr31q8bzJj6MXDSKZ5ak3MZek4iy6eixwya+HFUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734381996; c=relaxed/simple; bh=kFBkDnSnEZZ1VfI5FksgAvdRIAP5QPxLBN+/Yu2XlRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mTn2ZL8Z4jdSTFZO02i+3zO4w/INUKmxLAiXhof2ZbRdj8rHpUuC/ESLvhTs3LzXHuOUwcdz3kvhDhYkji5xygySzvKv7KitaPkMGsvkX6J26yFoluTPHHGdz9ouh5YoO28bSiXlUtnQBGRstloR3B33E0ztqrJxQtAAdbtqx6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Fq8ab15z; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=rWCymyrt; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Fq8ab15z; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=rWCymyrt; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Fq8ab15z"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="rWCymyrt"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Fq8ab15z"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="rWCymyrt" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2B59E1F37E; Mon, 16 Dec 2024 20:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1734381993; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zf3j+7x8OWqZs5Flqu4Qd02MEQlkGNkjLaHkJZbmiPk=; b=Fq8ab15zLwMJeAcPPchg2JxEmVpMu7TNStBTYe+WK7joiuL2w08lSnO6e2fT8N0aYgUN3w S6r+Z0G+a+zvcqQVKfd71OYRQeKEWh+0XbBYmJ6gY/qXl40vYAp2ktK3J32eAkONhNYKiS nwjqmjiCXPjqFIE46zgjGJyQX9xq/Fo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1734381993; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zf3j+7x8OWqZs5Flqu4Qd02MEQlkGNkjLaHkJZbmiPk=; b=rWCymyrtoEBRhsmkHgTRbBBmhwNwhZpD3ySnhk2LHZEYzKRKfsvB/tbEvpMHwLQpU+6Kp5 XvGXsau6GEOVkhAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1734381993; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zf3j+7x8OWqZs5Flqu4Qd02MEQlkGNkjLaHkJZbmiPk=; b=Fq8ab15zLwMJeAcPPchg2JxEmVpMu7TNStBTYe+WK7joiuL2w08lSnO6e2fT8N0aYgUN3w S6r+Z0G+a+zvcqQVKfd71OYRQeKEWh+0XbBYmJ6gY/qXl40vYAp2ktK3J32eAkONhNYKiS nwjqmjiCXPjqFIE46zgjGJyQX9xq/Fo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1734381993; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zf3j+7x8OWqZs5Flqu4Qd02MEQlkGNkjLaHkJZbmiPk=; b=rWCymyrtoEBRhsmkHgTRbBBmhwNwhZpD3ySnhk2LHZEYzKRKfsvB/tbEvpMHwLQpU+6Kp5 XvGXsau6GEOVkhAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DB406137CF; Mon, 16 Dec 2024 20:46:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id v8rsKqiRYGfiZAAAD6G6ig (envelope-from ); Mon, 16 Dec 2024 20:46:32 +0000 From: Gabriel Krisman Bertazi To: axboe@kernel.dk, asml.silence@gmail.com Cc: io-uring@vger.kernel.org, Gabriel Krisman Bertazi Subject: [PATCH RESEND v2 3/9] io_uring/futex: Allocate ifd with generic alloc_cache helper Date: Mon, 16 Dec 2024 15:46:09 -0500 Message-ID: <20241216204615.759089-4-krisman@suse.de> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241216204615.759089-1-krisman@suse.de> References: <20241216204615.759089-1-krisman@suse.de> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Score: -5.30 X-Spamd-Result: default: False [-5.30 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_TO(0.00)[kernel.dk,gmail.com]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Flag: NO X-Spam-Level: Instead of open-coding the allocation, use the generic alloc_cache helper. Signed-off-by: Gabriel Krisman Bertazi --- io_uring/futex.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/io_uring/futex.c b/io_uring/futex.c index e29662f039e1..30139cc150f2 100644 --- a/io_uring/futex.c +++ b/io_uring/futex.c @@ -251,17 +251,6 @@ static void io_futex_wake_fn(struct wake_q_head *wake_q, struct futex_q *q) io_req_task_work_add(req); } -static struct io_futex_data *io_alloc_ifd(struct io_ring_ctx *ctx) -{ - struct io_futex_data *ifd; - - ifd = io_alloc_cache_get(&ctx->futex_cache); - if (ifd) - return ifd; - - return kmalloc(sizeof(struct io_futex_data), GFP_NOWAIT); -} - int io_futexv_wait(struct io_kiocb *req, unsigned int issue_flags) { struct io_futex *iof = io_kiocb_to_cmd(req, struct io_futex); @@ -331,7 +320,7 @@ int io_futex_wait(struct io_kiocb *req, unsigned int issue_flags) } io_ring_submit_lock(ctx, issue_flags); - ifd = io_alloc_ifd(ctx); + ifd = io_cache_alloc(&ctx->futex_cache, GFP_NOWAIT, NULL); if (!ifd) { ret = -ENOMEM; goto done_unlock;