Skip to contentSkip to conversation

improve the performance of some memory copy functions

PATCH In review Miao Xie 3 participants 4 messages Sep 2, 2010 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

v2 cover improve the performance of some memory copy functions

Changes from V1 to V2:
- change the version of GPL from version 2.1 to version 2

When I looked into the performance problem of the btrfs, I found some memory copy functions of the kernel(such as: x86_64's memmove)is very inefficient, but the glibc version is quite fast, in some cases it is 10 times faster than the kernel version.

This patchset introduced some macros and functions of the glibc, and improved memmove and memcpy of the generic version and memmove of x86_64 in the kernel.

I have tested this patchset by doing 500 bytes memory copy for 50000 times on x86_64:
memmove
2.6.36-rc1 2s 610445us
2.6.36-rc1 + patch 0s 257358us

After appling this patchset, the performance of the file creation and deletion on some filesystems also become better. I have tested the file creation and deletion performance with the following benchmark tool on my x86_64 box.
http://marc.info/?l=linux-btrfs&m=128212635122920&q=p3

Test steps:

# ./creat_unlink 50000

The result is following(Total time):
Ext4:

		2.6.36-rc1	2.6.36-rc1 + patchset

file creation 0.771240 0.698983 9.4%UP
file deletion 0.459065 0.425530 7.3%UP

Btrfs:

		2.6.36-rc1	2.6.36-rc1 + patchset

file creation 0.966807 0.947592 1.9%UP
file deletion 1.355671 1.217787 10.2%UP

BTW: I don't know the performance of the other architectures because I don't have the machine of those architectures, so I just improved the generic vesion and x86_64 version.

Who can help me to test the performance on the other architectures and compare it with the new generic version?

#1 lore raw
Quoted 1 line · Miao Xie

- change the version of GPL from version 2.1 to version 2

How were you able to do this? If the code derives from glibc (as your comments in the patches suggest), and if glibc is under the GPL v2.1, then you probably cannot simply change the license to v2.

Ingo

#2 lore raw
Quoted 1 line · Ingo Molnar

and if glibc is under the GPL v2.1

It's LGPL v2.1 which can be converted to GPL v2 under section 3 of its license. See: http://www.gnu.org/licenses/lgpl-2.1.html

cheers,
Chris

Signature · 1 line
 Chris Samuel  :  http://www.csamuel.org/  :  Melbourne, VIC
author
#3 lore raw
In reply to Ingo Molnar
Quoted 8 lines · Ingo Molnar
Quoted 1 line · Miao Xie

- change the version of GPL from version 2.1 to version 2

How were you able to do this? If the code derives from glibc (as your comments in the patches suggest), and if glibc is under the GPL v2.1, then you probably cannot simply change the license to v2.

I think we can do it, because the orignal code is under LGPL v2.1, LGPL v2.1 permits us to apply the terms of the ordinary GNU General Public License instead of it.

This is the clause of LGPL v2.1:
3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.

Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.

This option is useful when you wish to copy part of the code of the Library into a program that is not a library.

The following is the URL of LGPL v2.1:
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html

Thanks
Miao