Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp2029758rdb; Thu, 17 Aug 2023 08:47:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwOz8Yh6YVyEMq2uZXdM00iZU8NVIAefRE9o991CdM12eC5o4cdMdVeCZokwkP5r8ZqhmW X-Received: by 2002:a05:6a20:394b:b0:137:a3c9:aaa9 with SMTP id r11-20020a056a20394b00b00137a3c9aaa9mr129480pzg.16.1692287243413; Thu, 17 Aug 2023 08:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692287243; cv=none; d=google.com; s=arc-20160816; b=I6giidAy40maz1VoKifErB38VgHT9nlrqIyeUztShekr0GfHHVbW8JY3EM4ckZad2C tuSdyC1w3rhAAX5j7z3sXrEKavjthKSErpWUu6JOo42n7PUGdf40PHCIoAW4EBKVphSz 5aZMzcP5mY54oIm36lNxcH3raW50yArUneOKGfd9NSEQ8Jw6C6lMH9GPKH8ng9Vz5Qot +YWJ5deZ/NPi1HoZ7gggqYx22dFrmFN6OovKB3/PNL5N9t0OQbSEiVaTqGSoDWvgOzs1 mKYr5uq42p5bUjtUbak2PHZf962gHwq076woooeZqm3+8MWy8ToRMKXEEAI9xCmQqO+s 5JMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=qUN9aOOnR1cfPdQpkQiTcagBIlNf8z4Cv/q5ZuBnrzU=; fh=fw3/i9MG5EuCi82NNVjin3RLNCwD/VWIMZ83f6cFlt4=; b=YvX4Ll/6DVPrNZK7rVvKwKgMuyGeTnjanVVk+dSIJC1HN3rBm3AmDwIiBKyTjZ21+5 qsXinuGXVSF72KYMlQjlTDcmZCoBy0Epdgjfj++gxyHCzTdKW4V1VcVS80h/LeMV3k8J ivfNFDWzozEiElzplV4Xc2CC8D7t2E+R8neau1Puiqf501CRG0cV/A4bOv4K1A+/flQz sYCSsJRjN+2Qsc9Ko6KotFfwvQ+ab/zEd7a/cbNMXdlVlegAKoeM0VV2byJ/WsOQn8RD uvgJ3D7ZBZQOcMOQl71hmg1YWtCj0/Ai/CnIAYpb5LJrEfXvtyxD0mvaWX7sjHf6+xnv S1uA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m1-20020a633f01000000b00566058702e8si2253620pga.236.2023.08.17.08.47.10; Thu, 17 Aug 2023 08:47:23 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245185AbjHPM3f convert rfc822-to-8bit (ORCPT + 99 others); Wed, 16 Aug 2023 08:29:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245182AbjHPM3E (ORCPT ); Wed, 16 Aug 2023 08:29:04 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C10110C8 for ; Wed, 16 Aug 2023 05:28:54 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-257-TgG9qBlyOWi2Hcyfbaq8PA-1; Wed, 16 Aug 2023 13:28:51 +0100 X-MC-Unique: TgG9qBlyOWi2Hcyfbaq8PA-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 16 Aug 2023 13:28:47 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Wed, 16 Aug 2023 13:28:47 +0100 From: David Laight To: 'David Howells' , Al Viro , Linus Torvalds CC: Jens Axboe , Christoph Hellwig , "Christian Brauner" , Matthew Wilcox , "Jeff Layton" , "linux-fsdevel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v3 2/2] iov_iter: Don't deal with iter->copy_mc in memcpy_from_iter_mc() Thread-Topic: [PATCH v3 2/2] iov_iter: Don't deal with iter->copy_mc in memcpy_from_iter_mc() Thread-Index: AQHZ0DpP/l59sWTPXU+UuQ9VGbJikq/s16Kg Date: Wed, 16 Aug 2023 12:28:47 +0000 Message-ID: <03730b50cebb4a349ad8667373bb8127@AcuMS.aculab.com> References: <20230816120741.534415-1-dhowells@redhat.com> <20230816120741.534415-3-dhowells@redhat.com> In-Reply-To: <20230816120741.534415-3-dhowells@redhat.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,PDS_BAD_THREAD_QP_64, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS 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 From: David Howells > Sent: Wednesday, August 16, 2023 1:08 PM Given: > iter->copy_mc is only used with a bvec iterator and only by > dump_emit_page() in fs/coredump.c so rather than handle this in > memcpy_from_iter_mc() where it is checked repeatedly by _copy_from_iter() and > copy_page_from_iter_atomic(), Instead of adding the extra check to every copy: > +static __always_inline > +size_t __copy_from_iter(void *addr, size_t bytes, struct iov_iter *i) > +{ > + if (unlikely(iov_iter_is_copy_mc(i))) > + return __copy_from_iter_mc(addr, bytes, i); > + return iterate_and_advance(i, bytes, addr, > + copy_from_user_iter, memcpy_from_iter); > } Couldn't the relevant code directly call __copy_frtom_iter_mc() ? Or a version then checked iov_is_copy_mc() and then fell back to the standard function. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)