From: Andi Kleen Subject: Re: [PATCH V2 1/3] lib: introduce some memory copy macros and functions Date: Thu, 2 Sep 2010 12:40:08 +0200 Message-ID: <20100902104008.GB17167@basil.fritz.box> References: <4C7F3A2A.2000007@cn.fujitsu.com> <877hj4o76p.fsf@basil.nowhere.org> <4C7F7853.6000400@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andi Kleen , Peter Zijlstra , Ingo Molnar , Andrew Morton , Theodore Ts'o , Linux Kernel , Linux Ext4 , Linux Btrfs To: Miao Xie Return-path: Received: from one.firstfloor.org ([213.235.205.2]:52916 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830Ab0IBKkK (ORCPT ); Thu, 2 Sep 2010 06:40:10 -0400 Content-Disposition: inline In-Reply-To: <4C7F7853.6000400@cn.fujitsu.com> Sender: linux-ext4-owner@vger.kernel.org List-ID: > So I improve the generic version of memcpy and memmove, and x86_64's memmove > which are implemented by byte copy. One should also add that most memmove()s and memcpy()s are actually generated by gcc as inlines (especially if you don't use the "make my code slow" option aka -Os) and don't use the fallback. The fallback depends on the gcc version and if gcc thinks the data is aligned or not. Sometimes one can get better code in the caller by making sure gcc knows the correct alignment (e.g. with suitable types) and size. This might be worth looking at for btrfs if it's really that memmove heavy. > > > >I have some systemtap scripts to measure size/alignment distributions of > >copies on a kernel, if you have a particular workload you're interested > >in those could be tried. > > Good! Could you give me these script? ftp://firstfloor.org/pub/ak/probes/csum.m4 You need to run them through .m4 first. They don't measure memmove, but that should be easy to add. -Andi