Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp500508lqt; Fri, 19 Apr 2024 02:10:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTLXB8+M8ycxX6ImJEDhk/3eI5XR2xFOd9FdDWcyVBgZzOGhGkX51rYCIwY20caxBbJs4CPL9CzU0Gifa9dVHygnC19xkUi7dlAuqzGQ== X-Google-Smtp-Source: AGHT+IFO5oN8gSzAEjarLirH0z6BLswDg2XDEWMGPn9b5DkkylPk8sFZdFEqKFfQutntwwJAceV1 X-Received: by 2002:a05:6870:41c1:b0:21e:7751:312c with SMTP id z1-20020a05687041c100b0021e7751312cmr1642099oac.30.1713517833852; Fri, 19 Apr 2024 02:10:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713517833; cv=pass; d=google.com; s=arc-20160816; b=lx3wsxtz3JaeEM+8S9awavGLiILCSEFqcxI/9G4HhE48HmqRvXlSr9TuIrAWrNaMJC AFcYB9PxcI9b8VOkXAhxePH8sGFW5PoEKk0yu1bjcY+p6O1DrWbruA+rQe7/yv+pBZ+B pDf+fjxp5TzsfRaaU8nFmV1UCVCjz+2uSYuIojs72MCqagqt15RySHkcj1JBk6ZFAaDW KRpeeLQ2pp5oLySZDFEj0wVYOaJC4ekA3ORAKgahAp4pUckVsfJsyWHbMJqFP3crnwtx LacrVsoVfYLxoKzgon3Jbbz4UlnQSL01tUzMjUuX33qcXCcgXVMxswYI14FUsvZ/bXlo iFpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=GWbOHnJP1pHmTFSRj5p81kQNIK1WM4HnM4i5OImuD8M=; fh=8fKFI8Wh1Puly5qK1vEGsxncLjth6TICfcgF4IPvP6o=; b=x+P+FADn4DWnmYeOliVZA66tpLbqMjf/coK9RQStbPw45XAJdp5/ENhxOcQDSIb76j g/oNLWDgQJeNJSvreyr2cTRj1ljiPlhg1W2Lyzpn3/S77R82LpDJqG5LYEfUELczCLDq X+fefGz5R3HGVQl2cX4vKW+0005u2xqTrpYuDxLpgK+iIAHGpArCs6QBl/WhOzti/JaJ n6+IqemKtl3UoB8R2I3GfaU6J3/Cr3ZbIJRgR2L4Nf2Rukqt9rnu9OEoDdJDfI2IM5aS Ec93u80CbXwVe+h2F+zgsCDcUDHHg4rtScRXTGFUZ/EEHPyq8RpcHrbwg53S2n+kik1e D6WA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=IyECAjlz; arc=pass (i=1 spf=pass spfdomain=gnuweeb.org dkim=pass dkdomain=gnuweeb.org dmarc=pass fromdomain=gnuweeb.org); spf=pass (google.com: domain of linux-kernel+bounces-151215-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=gnuweeb.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z10-20020aa7888a000000b006ecfa5a3b2fsi3050084pfe.77.2024.04.19.02.10.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:10:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151215-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=IyECAjlz; arc=pass (i=1 spf=pass spfdomain=gnuweeb.org dkim=pass dkdomain=gnuweeb.org dmarc=pass fromdomain=gnuweeb.org); spf=pass (google.com: domain of linux-kernel+bounces-151215-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=gnuweeb.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CC23AB20E7A for ; Fri, 19 Apr 2024 09:10:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2E317580B; Fri, 19 Apr 2024 09:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b="IyECAjlz" Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE5AF5FBB5; Fri, 19 Apr 2024 09:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.81.211.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713517821; cv=none; b=Buez8dwfCMIRgevItCP3fkQgfr4UlkSoPr0QXQDlcqVsvFD5wzkhzPYXmU4Z001UqqJhp1ZZMwxuEEGGkzGSp/vjS9Ij0aCmhnE2+6hRUTNoP171YMPtaYoCPpB6EzBedgBAr47d95udnc49GUxSyPMOPtYgYojG/vdXOp1t5aQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713517821; c=relaxed/simple; bh=FUyrDkEoZkFe3j2Sa11pBqz9kStQx6lt90ArRaAHaYo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Q2wzrzmSXok0JDAfWe0UZgam09UwWFrJbsfRu3NPu7DTABwkEeEj+8RywoM0qjipdXa1Sl1aUPKzvXNWegt6eNSRfyAsM2ankhZjZf2XmHCClEDQ2EIAYznlpCySM+5BsMMjbwQc5WKV8VqhjB9QYIXgqAIkAvJkNoSM3oDgmTg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=gnuweeb.org; spf=pass smtp.mailfrom=gnuweeb.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b=IyECAjlz; arc=none smtp.client-ip=51.81.211.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=gnuweeb.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gnuweeb.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1713517813; bh=FUyrDkEoZkFe3j2Sa11pBqz9kStQx6lt90ArRaAHaYo=; h=References:In-Reply-To:From:Date:Subject:To:Cc; b=IyECAjlzs3S9RlCI58V209dKzrihrBf2qjZXpTpVQA/pl8gcbkwlPhSZ+cD/Gl3/+ MNP0IcdBK2bVd4vNtIPWmFL5JXmci5q+p/GjXQr9sSwnH5yBNJoqYOOInBvyNQOpOk oeBW46fJmUdwO3+wSdIK7lDrIyHk3VGp4BR5LjHof4A0KIhCFeTBDNH3hCqa+ih/vL 4mvcZ7/nysID8rjWrtzpiGZK+JTAg5EAsaiz6z17XM9zYbxl4NRY4Ev29VZC+e4VjV yPS4DnOPVjiFzsNvDxtHgIpyows6BYdf3eMCcUBeOgNYwFl7e1f7oJ7PnFTO139JCj ElyuRYd0nXhtQ== Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by gnuweeb.org (Postfix) with ESMTPSA id 616FC24AE8F; Fri, 19 Apr 2024 16:10:13 +0700 (WIB) Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-4347cb2bf76so3686681cf.0; Fri, 19 Apr 2024 02:10:13 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUOGYho+A2nxpv0r8Eji6Ww2HtUn/Uvsg9Nrgi/55BsNF6BjZRJTiaq8AUj6exiaufe50HX9JgZySCU9ufoIlxhYGNUnmWFw2M= X-Gm-Message-State: AOJu0YwkR0mJpf0odweklFg+6UH+76pGD4XTCovmwMBvUiYIE+ySNttQ gXU3byWMZ1bDV+Z/AeLmOrl7FY+KpmXgOr9aD6SnU+PayysxJhfKp3rsKHz4UHFSKtq+XVThoDQ t4+LGK0p6UEnOawzaUChcfFI2BF8= X-Received: by 2002:ac8:4e21:0:b0:438:d78f:66a7 with SMTP id d1-20020ac84e21000000b00438d78f66a7mr310205qtw.0.1713517812443; Fri, 19 Apr 2024 02:10:12 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240418093143.2188131-1-xue01.he@samsung.com> In-Reply-To: <20240418093143.2188131-1-xue01.he@samsung.com> From: Ammar Faizi Date: Fri, 19 Apr 2024 16:09:56 +0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] io_uring: releasing CPU resources when polling To: hexue Cc: Linux Kernel Mailing List , io-uring Mailing List , Jens Axboe , Pavel Begunkov , Kanchan Joshi , Kundan Kumar , Anuj Gupta , Wenwen Chen , Ruyi Zhang , Xiaobing Li , cliang01.li@samsung.com, peiwei.li@samsung.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 19, 2024 at 3:47=E2=80=AFPM hexue wrote: > +void init_hybrid_poll_info(struct io_ring_ctx *ctx, struct io_kiocb *req= ) > +{ > + u32 index; > + > + index =3D req->file->f_inode->i_rdev; > + struct iopoll_info *entry =3D xa_load(&ctx->poll_array, index); > + > + if (!entry) { > + entry =3D kmalloc(sizeof(struct iopoll_info), GFP_KERNEL)= ; > + entry->last_runtime =3D 0; > + entry->last_irqtime =3D 0; > + xa_store(&ctx->poll_array, index, entry, GFP_KERNEL); > + } GFP_KERNEL may fail; you must check for failure. Otherwise, it could lead to NULL pointer dereference. --=20 Ammar Faizi