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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CC1DE71072 for ; Thu, 21 Sep 2023 14:05:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E85AD6B0168; Thu, 21 Sep 2023 10:05:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E35A36B016F; Thu, 21 Sep 2023 10:05:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D24166B01A4; Thu, 21 Sep 2023 10:05:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BFF2D6B0168 for ; Thu, 21 Sep 2023 10:05:18 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 79144A05DF for ; Thu, 21 Sep 2023 14:05:18 +0000 (UTC) X-FDA: 81260776716.17.E427803 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by imf10.hostedemail.com (Postfix) with ESMTP id EF7FFC000F for ; Thu, 21 Sep 2023 14:05:14 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf10.hostedemail.com: domain of david.laight@aculab.com designates 185.58.85.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695305115; h=from:from:sender: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=uWAKVOUYoDY4uJYICwUaMLuYidPeQkssfflARp9wTpQ=; b=tPaQTJkNOgpyKNGwBFhi9RE/XAPq5KKF35k/JlrdwgIWdv32MC3AkOulb4P8z1fqi95ZJJ V7aJNAmEHHMkZf4/hE/3aKIu/x5B8oFcJS+BGBTSNbAcaw6/ps00e5N0FuIAXPcArlkCvr jhaAJEKHgc3NzzxJ9GQj3SJEK2PbfLk= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf10.hostedemail.com: domain of david.laight@aculab.com designates 185.58.85.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695305115; a=rsa-sha256; cv=none; b=mdvzsjcwdlqX5MQ/M5okXzJ/owa8ga5B8lH3qKKi9tVbI7522EjeTW4riNNyH4FK9mXhat /JPh60wtfVOJWsL7BDKEW0rmH8BeFybvogGNlZ/HbKBPXo3kyF5OP5vwT6Vfa/ySob5CaO tHm9YsOEAM3Qkx+fvmyvdMzfMCnfDGU= 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-78-tT6XIwH6NoO3sNNrU8Sykg-1; Thu, 21 Sep 2023 15:05:00 +0100 X-MC-Unique: tT6XIwH6NoO3sNNrU8Sykg-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; Thu, 21 Sep 2023 15:05:00 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Thu, 21 Sep 2023 15:05:00 +0100 From: David Laight To: 'David Howells' , Jens Axboe CC: Al Viro , Linus Torvalds , Christoph Hellwig , "Christian Brauner" , Matthew Wilcox , "Jeff Layton" , "linux-fsdevel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-mm@kvack.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v5 00/11] iov_iter: Convert the iterator macros into inline funcs Thread-Topic: [PATCH v5 00/11] iov_iter: Convert the iterator macros into inline funcs Thread-Index: AQHZ7BD/kh4zTlIOdEezFNQQd09cYrAlRT1Q Date: Thu, 21 Sep 2023 14:04:59 +0000 Message-ID: <591a70bf016b4317add2d936696abc0f@AcuMS.aculab.com> References: <20230920222231.686275-1-dhowells@redhat.com> In-Reply-To: <20230920222231.686275-1-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: quoted-printable X-Rspamd-Queue-Id: EF7FFC000F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ai9inxpwom5cm8rh3zs5bjrj6uim5aqw X-HE-Tag: 1695305114-232879 X-HE-Meta: U2FsdGVkX19SJKZ4Vi/qrvXjcP6Pbo8cR8J682TUx5PE8RQ/O1d9XEtl16Fql+mrRyqmiRGP8Xx8nmHWoOvb1Ojxpw0A89irWAcgmJW5sSCPdqrB2pB4RStHU9DJnxLfy5wOh2Otwo96MI2y/nnTOk55Rikc7r0GJ9/6YSExRyo1oJte8KF4AcuURfnqIqjBjLi/2me89J47xiyUYtvRkDEjQqgRpbx/0pXy/2rgNfJWyYYJjh/LN7aHaHrNXT+IU+0U0yDCpbFWfb4L/alPfy/9+oyW6ETD4j9G8Ul/4GobpyiaZjZljLg/MyvJ6gBYyuHH8mNO4323xfGvD3QFU7wqrlNlEJnSV6asUbu+FEBRn87uJIHE6BOrUP6R0Kx1ot2Xx9CSNWdV0CQHrpfe7U/Tzns03C5OHe3/UrGA/m24r0r5iwMIagdgiPfZAJ7ke9dgB7bAQIrIwIB8/d7fwP8ltC/khbmkhx9yxwU7PAWo0sgiQFt+XA0hAnPxpEIVRDWsGQYp7RjYq3En3nM+EX5uT+NRxhb21sucDiuKJnrNveEXF26yAtYBjOMaQkiDTTAEjuaLIvezKQT9auSo/Vfj86FUhcDOZ+LPyGnQm8Cap/6kbFUb7DMiWz8570I4HIA0+lCM2MpoSvfnAj1CIb9sK7Kjpb3BRlnZn8s8+Lg0yJ350ic6DhRxQ6EDbENfXinjlbesGbXjaCqGh30vUiFn8sip2wKtf8LQRtZZStd+ejie8WxKRDCVfhhYveHeXtQHHJIFP0aAl341WzqsATzt+IROzUjoMShOgE0RkZfQfqNcxXCveMwSAZhiziQ0nUFRshvFhtW56OmQfB/JKP0yJOQQOlIOa1fXZW56P4gfNfD4/tP97cp9shv4R2GeOiuwRdDZUa1O5HUhpeahhe+INn1VJETQhbxKyQPatC9YxABFaA2YeBZzcC9Nl01d0yTMod9cjioY+RSqjU2 azeGhPSX lUDyUjOZE8X9a7wVW7b9DIZDFmCV7eClVT3tvo835Brw05Bl40K6Ic/IVrzARVHWiPuvEQOrUeanrJ5Wa8Nnr6tHGPGhUgHgiKICFYDxpLFcNdUMJabtRXcp+2Us3WQXt6F8Trwss9WIEUygfRUJsJgtHtdQgi3tKrstFayBeXwZ6Zjt6+FX4HKCsFwPEDRME3+9qWJ10vN5unLcDOH0tr4uWZnzfK50EeVpvnQKQHfOHlXplderZNotPbew9Qxtjta+ePss0tRSK+YYdbwh2fgdI6A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: David Howells > Sent: 20 September 2023 23:22 ... > (8) Move the copy-and-csum code to net/ where it can be in proximity wit= h > the code that uses it. This eliminates the code if CONFIG_NET=3Dn a= nd > allows for the slim possibility of it being inlined. >=20 > (9) Fold memcpy_and_csum() in to its two users. >=20 > (10) Move csum_and_copy_from_iter_full() out of line and merge in > csum_and_copy_from_iter() since the former is the only caller of the > latter. I thought that the real idea behind these was to do the checksum at the same time as the copy to avoid loading the data into the L1 data-cache twice - especially for long buffers. I wonder how often there are multiple iov[] that actually make it better than just check summing the linear buffer? I had a feeling that check summing of udp data was done during copy_to/from_user, but the code can't be the copy-and-csum here for that because it is missing support form odd-length buffers. Intel x86 desktop chips can easily checksum at 8 bytes/clock (But probably not with the current code!). (I've got ~12 bytes/clock using adox and adcx but that loop is entirely horrid and it would need run-time patching. Especially since I think some AMD cpu execute them very slowly.) OTOH 'rep movs[bq]' copy will copy 16 bytes/clock (32 if the destination is 32 byte aligned - it pretty much won't be). So you'd need a csum-and-copy loop that did 16 bytes every three clocks to get the same throughput for long buffers. In principle splitting the 'adc memory' into two instructions is the same number of u-ops - but I'm sure I've tried to do that and failed and the extra memory write can happen in parallel with everything else. So I don't think you'll get 16 bytes in two clocks - but you might get it is three. OTOH for a cpu where memcpy is code loop summing the data in the copy loop is likely to be a gain. But I suspect doing the checksum and copy at the same time got 'all to complicated' to actually implement fully. With most modern ethernet chips checksumming receive pacakets does it really get used enough for the additional complexity? =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)