From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0A16C433B4 for ; Mon, 12 Apr 2021 10:17:34 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C6476128A for ; Mon, 12 Apr 2021 10:17:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C6476128A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-YgmM62m_PdWi4lDa2tj1gg-1; Mon, 12 Apr 2021 06:17:29 -0400 X-MC-Unique: YgmM62m_PdWi4lDa2tj1gg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C0F710053E7; Mon, 12 Apr 2021 10:17:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64D035D9F0; Mon, 12 Apr 2021 10:17:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0FC7F4EE0B; Mon, 12 Apr 2021 10:17:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13CAH9UY029899 for ; Mon, 12 Apr 2021 06:17:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id D8C302138BB3; Mon, 12 Apr 2021 10:17:09 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D314B2138BB2 for ; Mon, 12 Apr 2021 10:17:07 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 75252811E7F for ; Mon, 12 Apr 2021 10:17:07 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-VNVi6GZBMiqORxIizNplaA-1; Mon, 12 Apr 2021 06:17:03 -0400 X-MC-Unique: VNVi6GZBMiqORxIizNplaA-1 Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lVtcp-004AsT-ID; Mon, 12 Apr 2021 10:17:00 +0000 Date: Mon, 12 Apr 2021 11:16:59 +0100 From: Christoph Hellwig To: Ming Lei Message-ID: <20210412101659.GA993044@infradead.org> References: <20210401021927.343727-1-ming.lei@redhat.com> <20210401021927.343727-9-ming.lei@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210401021927.343727-9-ming.lei@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: dm-devel@redhat.com Cc: Jens Axboe , Mike Snitzer , linux-block@vger.kernel.org, dm-devel@redhat.com, Jeffle Xu Subject: Re: [dm-devel] [PATCH V5 08/12] block: use per-task poll context to implement bio based io polling X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > +static int blk_bio_poll_io(struct io_context *submit_ioc, > + struct io_context *poll_ioc) Givem that poll_ioc is always current->io_context there is no need to pass it. > + struct blk_bio_poll_ctx *poll_ctx = poll_ioc ? > + poll_ioc->data : NULL; and it really should not be NULL here, should it? > +static int __blk_bio_poll(blk_qc_t cookie) > +{ > + struct io_context *poll_ioc = current->io_context; > + pid_t pid; > + struct task_struct *submit_task; > + int ret; > + > + pid = (pid_t)cookie; > + > + /* io poll often share io submission context */ > + if (likely(current->pid == pid && blk_bio_ioc_valid(current))) > + return blk_bio_poll_io(poll_ioc, poll_ioc); > + > + submit_task = find_get_task_by_vpid(pid); > + if (likely(blk_bio_ioc_valid(submit_task))) > + ret = blk_bio_poll_io(submit_task->io_context, poll_ioc); > + else > + ret = 0; > + if (likely(submit_task)) > + put_task_struct(submit_task); Wouldn't it make more sense to just store the submitting context in the bio, even if that uses more space? Having to call find_get_task_by_vpid in the poll context seems rather problematic. Note that this requires doing the refacoring to get rid of the separate blk_qc_t passed up the stack I asked for earlier, but hiding all these details seems like a really useful change anyway. -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCCF1C433ED for ; Mon, 12 Apr 2021 10:17:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DD776128A for ; Mon, 12 Apr 2021 10:17:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237440AbhDLKRX (ORCPT ); Mon, 12 Apr 2021 06:17:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237302AbhDLKRW (ORCPT ); Mon, 12 Apr 2021 06:17:22 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEF58C061574 for ; Mon, 12 Apr 2021 03:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WTvPD46g2q8trOCLl4Uhn+tLIWuoy1Yp9UfY60Ss47Q=; b=Ck7Ne9kVDsvce1CoQLIgLoxnU7 qq4aIzD+VRZzTBJtdLGOZBOyl3a2TP9+oIlFU+OpxAERsRbA+oB+Z4w7QUXupG3LVnxe0vT5HxzXC X1WyGFWQpEymBlaohnSm6+CAYvSNJan3nu6JHydvw0C8fXfCfvVQ2jk4a4Pg6SF4AhBePuvPPY43i YupCpnSuyjhzeUd6MVvomnmW1XgAB73/axZqlCTyqyTM4DhBzevEskG9OY1xUDlw1ztHQrtT8cq/r U5xdK0R6WjcOUwIkYEkdlSruTV3P8RfgmbnOatI71laiz8roG0eqkljTYMXBoGvejucarHAaCMCbL AItG6RuA==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lVtcp-004AsT-ID; Mon, 12 Apr 2021 10:17:00 +0000 Date: Mon, 12 Apr 2021 11:16:59 +0100 From: Christoph Hellwig To: Ming Lei Cc: Jens Axboe , linux-block@vger.kernel.org, Jeffle Xu , Mike Snitzer , dm-devel@redhat.com, Hannes Reinecke Subject: Re: [PATCH V5 08/12] block: use per-task poll context to implement bio based io polling Message-ID: <20210412101659.GA993044@infradead.org> References: <20210401021927.343727-1-ming.lei@redhat.com> <20210401021927.343727-9-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210401021927.343727-9-ming.lei@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org > +static int blk_bio_poll_io(struct io_context *submit_ioc, > + struct io_context *poll_ioc) Givem that poll_ioc is always current->io_context there is no need to pass it. > + struct blk_bio_poll_ctx *poll_ctx = poll_ioc ? > + poll_ioc->data : NULL; and it really should not be NULL here, should it? > +static int __blk_bio_poll(blk_qc_t cookie) > +{ > + struct io_context *poll_ioc = current->io_context; > + pid_t pid; > + struct task_struct *submit_task; > + int ret; > + > + pid = (pid_t)cookie; > + > + /* io poll often share io submission context */ > + if (likely(current->pid == pid && blk_bio_ioc_valid(current))) > + return blk_bio_poll_io(poll_ioc, poll_ioc); > + > + submit_task = find_get_task_by_vpid(pid); > + if (likely(blk_bio_ioc_valid(submit_task))) > + ret = blk_bio_poll_io(submit_task->io_context, poll_ioc); > + else > + ret = 0; > + if (likely(submit_task)) > + put_task_struct(submit_task); Wouldn't it make more sense to just store the submitting context in the bio, even if that uses more space? Having to call find_get_task_by_vpid in the poll context seems rather problematic. Note that this requires doing the refacoring to get rid of the separate blk_qc_t passed up the stack I asked for earlier, but hiding all these details seems like a really useful change anyway.