Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1693142ybz; Sat, 18 Apr 2020 06:32:37 -0700 (PDT) X-Google-Smtp-Source: APiQypKB5YZEgZk9n05CiJC/RyOrPQacREWKhz0eQTx1WSq53pUDMA7ch2bvOlj9FwwN5A2vsP/M X-Received: by 2002:aa7:c610:: with SMTP id h16mr6851254edq.323.1587216757498; Sat, 18 Apr 2020 06:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587216757; cv=none; d=google.com; s=arc-20160816; b=Ofu2rQQJlaxnEXdp5v3KFvuPsL41uEABUu5fjCuu2X+t9hqwFsj1YoZF7haNyFpbAR mp0y5ITW29NDZtwtcX8Yv1acczKoEfd+Kpvuzf/TTtuzHp2XNXoz9UHpldiR0hk2DDkW 7BE96vM6/Ehn61I1w/ehtSaIpTZpt4zAaOPSS4XqDrIBNKvE/DYA54b2MxKMBa04MM/F Tq4eVe7FazaR1wzNl04jQD8XvD2EfO50b/IgaD6URkwxDPnIGSJKEPbDpEC87Jhv+yYl 8R78bA4H0OtxNAra8AFoFR0KXNDu1BcjuWk45JJo0gHRPC7UV8SOktsqJQQEshS077sn 6cqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=P4JTpPmXYXOCg4BC3JscgqumYAGOTrx5/0ud2+a7yE0=; b=ddH33fxp4m9MeAwT4k/xVGT6N5HGHUM+CzDIDPzWdhex98GGljsUG9XDu0ZwxVWdXp YTGxG6FyV1bZ/JNx1XED0WRxGT3apq9BAOq9ISKbdiFeP8plyYlwKkGmMl2y+ynanz4t LQQPKqxVb0M5CBazeQCVrKwXeuwhrIiGH38atQuSKTNSge+cZhzqqssCoeS6259XpqBI uoVwpbyoXB4NfJk2+i5ZSSHDY1t8J2vOmHNKsHlJWGqW5U+wbpcGYYHAF2jKvNUaze4s L7k+6FoAoZRdDcj9F2F/kjWZJ5q/wGfauNEE9YuMWNgjQjnbKwNbIYOUhnr3HTvf13Sg qiDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i64si16683288edc.506.2020.04.18.06.32.13; Sat, 18 Apr 2020 06:32:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1725991AbgDRN17 convert rfc822-to-8bit (ORCPT + 99 others); Sat, 18 Apr 2020 09:27:59 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([146.101.78.151]:58124 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725804AbgDRN17 (ORCPT ); Sat, 18 Apr 2020 09:27:59 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-163-iEq3HNYPO8Gv4ZuIWssZ0w-1; Sat, 18 Apr 2020 14:27:54 +0100 X-MC-Unique: iEq3HNYPO8Gv4ZuIWssZ0w-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Sat, 18 Apr 2020 14:27:54 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Sat, 18 Apr 2020 14:27:54 +0100 From: David Laight To: 'Mikulas Patocka' , Dan Williams CC: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "Peter Zijlstra" , X86 ML , "Linux Kernel Mailing List" , device-mapper development Subject: RE: [PATCH] x86: introduce memcpy_flushcache_clflushopt Thread-Topic: [PATCH] x86: introduce memcpy_flushcache_clflushopt Thread-Index: AQHWFLZf1uwJ38llN06XsGw6srhIuah+3wRg Date: Sat, 18 Apr 2020 13:27:53 +0000 Message-ID: <69c2e011c5814255926f309dd50e6d67@AcuMS.aculab.com> References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka > Sent: 17 April 2020 13:47 ... > Index: linux-2.6/drivers/md/dm-writecache.c > =================================================================== > --- linux-2.6.orig/drivers/md/dm-writecache.c 2020-04-17 14:06:35.139999000 +0200 > +++ linux-2.6/drivers/md/dm-writecache.c 2020-04-17 14:06:35.129999000 +0200 > @@ -1166,7 +1166,10 @@ static void bio_copy_block(struct dm_wri > } > } else { > flush_dcache_page(bio_page(bio)); > - memcpy_flushcache(data, buf, size); > + if (likely(size > 512)) > + memcpy_flushcache_clflushopt(data, buf, size); > + else > + memcpy_flushcache(data, buf, size); Hmmm... have you looked at how long clflush actually takes? It isn't too bad if you just do a small number, but using it to flush large buffers can be very slow. I've an Ivy bridge system where the X-server process requests the frame buffer be flushed out every 10 seconds (no idea why). With my 2560x1440 monitor this takes over 3ms. This really needs a cond_resched() every few clflush instructions. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)