Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2566686rwb; Mon, 15 Aug 2022 07:32:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR66PETrtyLiZ9qFTd8w0MLWAK8VpmDKIPrYGzQYot5wUpPB1jrdV4R9s2JXhI0/T3n2fXZ8 X-Received: by 2002:a05:6402:3482:b0:43e:dd2:52a3 with SMTP id v2-20020a056402348200b0043e0dd252a3mr14948845edc.386.1660573931388; Mon, 15 Aug 2022 07:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660573931; cv=none; d=google.com; s=arc-20160816; b=ubooCwJLmwbYKar5PO53JReM4D0PG07ZOo2QGkPO55MEITUrutcdjZ/hzRYgY9nLm4 5ke1mYITbeTsWYjNSSTof/HRqlzUHTNJMh5UQ7k105W3wIjwhTfs+wcMhaKlv3XfMiIv OJ8csqyLNlSf9DnfDJkM7TEYELgIMeGGGVVYg2lPjvU6j/hsih7LZLB+meu/wbe0sM8h HtqD4wwhnbrheWdK6lKR/6Nwlaa07aWfJHVtIzOEnsbLBmnZmIT6VEfX+pcrt3xlC4Ze yBHfSJMnqNsLZcdHQCCdbaz6wEdwwQY+pri++zsjAS3d+IKOjOrIFLYNmjIyWImnwoGK c7HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9Ly9QT+qhOGC59U1DUD2uSyTYH7l3lh3lsWLdiMn2B4=; b=EBX1gaWjdiZxB0jme0TcqkYX4ybfpVCKYX0zLHWWO9H0jc7o/z+Ibjl9wJIzrSqm5r E+NHCU5Pc7TvI9qoWD8iUsvUe/Dbrw3FBLEyZkujCfixwXz4B+vXSvlYgNHuiHmsN4Ka N6Z426oj8bjo4bwY/cE3uUIyurMK3GwekM+72AVsHUGl39HY5FsPIZIjyRcQrk3EXw7M Tu2XDiJ61V5Pakq2Isyvk7tLAiXXgZsaeo3lls1aDKbrbhBtGLzHqly4V3N0b9vVyxZi TfWxWCO0o5VjdAUF4ZBgO9bvgQTuW95DcjUnbtugcEN4IeS+kuGRdlVd5NF0QgU3Psc6 ZPcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Q+VAsP/z"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o13-20020a056402438d00b0043e14ec047bsi8680745edc.6.2022.08.15.07.31.45; Mon, 15 Aug 2022 07:32:11 -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=@gmail.com header.s=20210112 header.b="Q+VAsP/z"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242745AbiHOOK5 (ORCPT + 99 others); Mon, 15 Aug 2022 10:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229780AbiHOOKy (ORCPT ); Mon, 15 Aug 2022 10:10:54 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5986265F; Mon, 15 Aug 2022 07:10:53 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id s23so3891916wmj.4; Mon, 15 Aug 2022 07:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=9Ly9QT+qhOGC59U1DUD2uSyTYH7l3lh3lsWLdiMn2B4=; b=Q+VAsP/zUox4R9ZtptQ9CPO6SOOuZwy8gTu5/HHaCgbJ9A8PeOmomNu7touZ1YwZia Xq5yddwVTi8VkFcCWisz6W83zI0FiUgSYAGJ34HGf8mpsFzF1wt54zJpK0Isn93GeKyL rZELMT8OZ7CTBP5i8dcM9jjg5DNeHPvb8cgU9r1PLOmQWqDBWg9Vg747ZtGXOVd8Zf6J m0TdDdoO1C8fbI4n/7sYXU55a1wk7Qg72aaPWyuS51bIc5tQPwTduCNP4aJI9uj22MKD pGASvHTORMkmtZskX809CrNRLRScUaEgdcgMF3efYrXyRDPfLgpdg6/1uXjw1P5YQEdf 4kwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=9Ly9QT+qhOGC59U1DUD2uSyTYH7l3lh3lsWLdiMn2B4=; b=l9be95TpxD5cXyVoe7lBFQpKk4kHqwALtj86RSmf8lRpYwUkvenmvdTdVsyn2MrIEr P94e+MpbnvHHrlMZ9o+Q2ks3pKfvr76NMNCEYPWjc7pXB2AwWF3ce58jcHwTL8bGk42o 7e5SxeG4Z8zeCp8MEi4t+iiL0OyF1wPVYC1EpLMliIhKl3JLtFloTsORSi+nqG0R5w1a HWna24BoUzDtW2ZKDhMlOsjQfRa6Xenu0HC8lvJ2zt0OGAa6wkVbuRVOFsRMqyyhlfql F2jYcUBSEW9SUb9QldTU0Wt5y0cEdjjFlflnEMJB2RWYoaYMufPtI5CVyKyiTSzJw3dE 6YTg== X-Gm-Message-State: ACgBeo2EdRaZcP6nnO+WmStagvzBQGi6sVRz85EG9RMHpi7n3gkmy2KI TRM9UIvnkrg23BgHndR8qXc= X-Received: by 2002:a1c:ed19:0:b0:3a5:4fb5:bcd6 with SMTP id l25-20020a1ced19000000b003a54fb5bcd6mr15839364wmh.100.1660572652336; Mon, 15 Aug 2022 07:10:52 -0700 (PDT) Received: from ?IPV6:2620:10d:c096:310::22ef? ([2620:10d:c092:600::2:886]) by smtp.gmail.com with ESMTPSA id n21-20020a05600c4f9500b003a5f3f5883dsm4713146wmq.17.2022.08.15.07.10.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Aug 2022 07:10:51 -0700 (PDT) Message-ID: <66945bc6-e567-b5a8-9b4d-2b620cf1bdc5@gmail.com> Date: Mon, 15 Aug 2022 15:09:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RFC net-next v3 23/29] io_uring: allow to pass addr into sendzc Content-Language: en-US To: Stefan Metzmacher , io-uring@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "David S . Miller" , Jakub Kicinski , Jonathan Lemon , Willem de Bruijn , Jens Axboe , kernel-team@fb.com References: <228d4841af5eeb9a4b73955136559f18cb7e43a0.1653992701.git.asml.silence@gmail.com> <56631a36-fec8-9c41-712b-195ad7e4cb9f@gmail.com> <4eb0adae-660a-3582-df27-d6c254b97adb@samba.org> <246ef163-5711-01d6-feac-396fc176e14e@samba.org> <9edd5970-504c-b088-d2b1-3a2b7ad9b345@gmail.com> From: Pavel Begunkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 8/15/22 14:30, Stefan Metzmacher wrote: [...] >>> that causes io_ring_exit_work() to wait for it.> It would be great if you or someone else could explain this in detail >>> and maybe adding some comments into the code. >> >> Almost, the mechanism is absolutely the same as with requests, >> and notifiers are actually requests for internal purposes. >> >> In __io_alloc_req_refill() we grab ctx->refs, which are waited >> for in io_ring_exit_work(). We usually put requests into a cache, >> so when a request is complete we don't put the ref and therefore >> in io_ring_exit_work() we also have a call to io_req_caches_free(), >> which puts ctx->refs. > > Ok, thanks. > > Would a close() on the ring fd block? I guess not, but the exit_work may block, correct? Right, close doesn't block, it queues exit_work to get executed async. exit_work() will wait for ctx->refs and then will free most of io_uring resources. > So a process would be a zombie until net released all references? The userspace process will exit normally, but you can find a kernel thread (kworker) doing the job. -- Pavel Begunkov