From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754834AbZBCBTM (ORCPT ); Mon, 2 Feb 2009 20:19:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751010AbZBCBS6 (ORCPT ); Mon, 2 Feb 2009 20:18:58 -0500 Received: from 89-43-179-112.volio.ro ([89.43.179.112]:2916 "EHLO server2.radioconsult.ro" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750845AbZBCBS5 (ORCPT ); Mon, 2 Feb 2009 20:18:57 -0500 X-Greylist: delayed 1466 seconds by postgrey-1.27 at vger.kernel.org; Mon, 02 Feb 2009 20:18:57 EST Message-ID: <498795C5.70507@radioconsult.ro> Date: Tue, 03 Feb 2009 02:54:29 +0200 From: Catalin Ionescu Reply-To: catalin.ionescu@radioconsult.ro Organization: Radio Consult SRL User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org Subject: MAP_LOCKED caused speed penalty X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm using 2.6.26 on a Debian box with Ahthlon64 X2 and 2.6.29-rc3-git3 on an Orion5x based board. The issue is visible on both, though not so significant on the Athlon64. For testing I have combined from 2 disks on two SATA ports. With just one disk the problem is not visible at all. When using the buffer allocating code with the MAP_LOCKED flag the direct transfer speed to the disk is significantly lower then when the MAP_LOCKED flag is not used. Orion5x -> 150MB/s vs. 205MB/s Athlon64 -> 165MB/s vs. 180MB/s The test code is: #include #include #include #include #include #include #include #include #include #include #include #include #include //////////////////////////////////////////////////////////////////////////////// #define BufferSize 0x00100000 #define BuffersNum ((0x40000000/BufferSize)*512) #define DrivesNum 2 static const char *Drives[]={"/dev/sdb","/dev/sdc","/dev/sdd","/dev/sde"}; #define BuffsPerDrive (0x01000000/BufferSize/DrivesNum) //////////////////////////////////////////////////////////////////////////////// int main(void) { void *Buf[DrivesNum][BuffsPerDrive],*Buf_[DrivesNum][BuffsPerDrive]; int fd[DrivesNum]; size_t i,j,BufIdx; uint32_t StartTime,LastTime; uint32_t _StepsNum; uint64_t _TotalTime; io_context_t Ctx[DrivesNum]; struct iocb CBs[DrivesNum][BuffsPerDrive]; struct iocb *CBPs[DrivesNum][BuffsPerDrive]; struct timeval tv; // Opens the files. for (i=0;i=BuffsPerDrive) io_getevents(Ctx[i],1,1,&Ev,NULL); io_prep_pwrite(&CBs[i][BufIdx],fd[i],Buf[i][BufIdx],BufferSize,(uint64_t)_StepsNum*BufferSize); io_submit(Ctx[i],1,&CBPs[i][BufIdx]); } gettimeofday(&tv,NULL); _TotalTime+=(LastTime=tv.tv_sec*1000000+tv.tv_usec-StartTime); BufIdx=(BufIdx+1)%BuffsPerDrive; if (!(_StepsNum%10)) printf("Step %u/%u - %.02lf MB/s - %.02lf MB/s \r", _StepsNum,BuffersNum, (float)BufferSize*DrivesNum/(int32_t)LastTime, (float)BufferSize*DrivesNum*(int32_t)_StepsNum/(int64_t)_TotalTime); } for (i=0;i