Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6670615rwr; Tue, 25 Apr 2023 01:47:53 -0700 (PDT) X-Google-Smtp-Source: AKy350a/gcAYhC8jM6JNXEYt0hrbrdr5vaFD12GCkoRLtE7nA733spMuSfYfUYksqVoxpnmgjCMH X-Received: by 2002:a17:90a:cf8f:b0:23d:e0e8:f453 with SMTP id i15-20020a17090acf8f00b0023de0e8f453mr15819616pju.38.1682412473582; Tue, 25 Apr 2023 01:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682412473; cv=none; d=google.com; s=arc-20160816; b=P9gQNAZrs0Bg+CqQ4jrPk0+m5JbeYim+E5TIBGbyVYbvbxqf+6Eyiw6Lgu9RDnNf/4 whxqRsf6r+wsxUAxr6IX0OdgIlXrgB8uuLFfkSGfh7l5BrwyYgjO6isSY1H2szjf85mP b9RV1nrASl1dytRRKn0i5m6HC+c6Uum56I4nyeT99dZkT42aaJRL+P8waRZTalZHL+/L a4S8JM0E2guBSFIkhu6mdT81eRD5lI7p/A6CCoSRtvz2x/Y2PLzU3SDoEo2nOI9RdMxE s+yiSx5LxheVosQnzCuIJRGTAtnm7Fbg1wIpn0yMKuTj/Jn4QlHSUVTiHWObvfK4qg37 6DMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=ZJYULa21bRSiosmoi3/4DldsRTvT4wpxgitPcs2X3GU=; b=CxQjn2nLbRAO+SefFLSsK+RgML70EqrqUs42StZj6/XNCF4MiiaZDe88LLHBRaOlOD cGU88YHkuvaTXUKUExD4co8SEj/6893a8HqOxpHtk+jQfOn+vGnsPVUFtciPRfooTdZe zrTjvJlzeSYPDWZwe2h62XehgCLjFLkXJnLNru4x5q5JMO5pMBeWO9TDiuNO5JLZ/0eG Ud+lUyzpSJ//zHxJnidOq5IJqLMR12nd8fhHCoKaDm3ghONMHPGPybNP3o4OCh3MM7wG YTALUyaePmIOPDqc2Nb1LBWwXrpAs6IOjkvVfLmPUmr77sGfe131r9Ftyy2YvBKno5nx Qr8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IcPucyqT; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb5-20020a17090b4a4500b00246fe4e326dsi17314174pjb.81.2023.04.25.01.47.42; Tue, 25 Apr 2023 01:47:53 -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=@redhat.com header.s=mimecast20190719 header.b=IcPucyqT; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233885AbjDYIlP (ORCPT + 99 others); Tue, 25 Apr 2023 04:41:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233653AbjDYIkg (ORCPT ); Tue, 25 Apr 2023 04:40:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 255CD13C3C for ; Tue, 25 Apr 2023 01:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682411823; h=from:from:reply-to:subject:subject: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=ZJYULa21bRSiosmoi3/4DldsRTvT4wpxgitPcs2X3GU=; b=IcPucyqTAnsQugHazkxLDCm+X5e/+f1qIEWie8iLVulmfJs+KGsHKLnQfju6//EPB0pkKw KUeBO713p+i/w8XuRadCJ5SFoPcDrhU2GcwDFPm6W0GxKM1L+U3lPA6vGSfP6IH+d3oshp idiS6gxLjA0qMUqfYtMV6jCIPlsJGcA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-396-fxzR9FbANCSO0wONI3r1UA-1; Tue, 25 Apr 2023 04:30:36 -0400 X-MC-Unique: fxzR9FbANCSO0wONI3r1UA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 61D97887402; Tue, 25 Apr 2023 08:30:35 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 185AC44007; Tue, 25 Apr 2023 08:30:30 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <1957131.PYKUYFuaPT@suse> References: <1957131.PYKUYFuaPT@suse> <20230331160914.1608208-1-dhowells@redhat.com> <20230331160914.1608208-42-dhowells@redhat.com> To: "Fabio M. De Francesco" Cc: dhowells@redhat.com, Matthew Wilcox , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Al Viro , Christoph Hellwig , Jens Axboe , Jeff Layton , Christian Brauner , Chuck Lever III , Linus Torvalds , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Martin K. Petersen" , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Subject: Re: [PATCH v3 41/55] iscsi: Assume "sendpage" is okay in iscsi_tcp_segment_map() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <494036.1682411430.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Tue, 25 Apr 2023 09:30:30 +0100 Message-ID: <494037.1682411430@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 Fabio M. De Francesco wrote: > > - if (recv) { > > - segment->atomic_mapped =3D true; > > - segment->sg_mapped =3D kmap_atomic(sg_page(sg)); > > - } else { > > - segment->atomic_mapped =3D false; > > - /* the xmit path can sleep with the page mapped so use = > kmap */ > > - segment->sg_mapped =3D kmap(sg_page(sg)); > > - } > > - > > + segment->atomic_mapped =3D true; > > + segment->sg_mapped =3D kmap_atomic(sg_page(sg)); > = > As you probably know, kmap_atomic() is deprecated. > = > I must admit that I'm not an expert of this code, however, it looks like= the = > mapping has no need to rely on the side effects of kmap_atomic() (i.e., = > pagefault_disable() and preempt_disable() - but I'm not entirely sure ab= out = > the possibility that preemption should be explicitly disabled along with= the = > replacement with kmap_local_page()). = > = > Last year I've been working on several conversions from kmap{,_atomic}()= to = > kmap_local_page(), however I'm still not sure to understand what's happe= ning = > here... > = > Am I missing any important details? Can you please explain why we still = need = > that kmap_atomic() instead of kmap_local_page()? = Actually, it might be worth dropping segment->sg_mapped and segment->data = and only doing the kmap_local when necessary. And this: struct msghdr msg =3D { .msg_flags =3D flags }; struct kvec iov =3D { .iov_base =3D segment->data + offset, .iov_len =3D copy }; r =3D kernel_sendmsg(sk, &msg, &iov, 1, copy); should really be using struct bvec, not struct kvec - then the mapping isn= 't necessary. It looks like this might be the only place the mapping is used= , but I'm not 100% certain. David