Project

General

Profile

Feature #13951

[PATCH] File#rename releases GVL

Added by normalperson (Eric Wong) about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:83060]

Description

rename(2) requires two pathname resolution operations which can
take considerable time on slow filesystems, release the GVL so
operations on other threads may proceed.

On fast, local filesystems, this change results in some slowdown
as shown by the new benchmark. I consider the performance trade
off acceptable as cases are avoided.

benchmark results:
minimum results in each 3 measurements.
Execution time (sec)
name    trunk   built
file_rename     2.648   2.804

Speedup ratio: compare with the result of `trunk' (greater is better)
name    built
file_rename     0.944
  • file.c (no_gvl_rename): new function (rb_file_s_rename): release GVL for renames
  • benchmark/bm_file_rename.rb: new benchmark

I will commit this next week as well as work on releasing GVL for
other operations where slow FS can have pathological slowdown
(unlink, link, symlink, readlink, readdir, mkdir, chmod, ...)


Files

0001-File-rename-releases-GVL.patch (2.64 KB) 0001-File-rename-releases-GVL.patch normalperson (Eric Wong), 09/29/2017 08:54 AM

Associated revisions

Revision 6c29f232
Added by normal about 2 years ago

NEWS: entries for GVL release in File and Dir

(more to come)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 60091
Added by normalperson (Eric Wong) about 2 years ago

NEWS: entries for GVL release in File and Dir

(more to come)

Revision 60091
Added by normal about 2 years ago

NEWS: entries for GVL release in File and Dir

(more to come)

Revision 60091
Added by normal about 2 years ago

NEWS: entries for GVL release in File and Dir

(more to come)

History

Updated by nobu (Nobuyoshi Nakada) about 2 years ago

  • Description updated (diff)

normalperson (Eric Wong) wrote:

I consider the performance trade off acceptable as cases are avoided.

I agree that it would be small enough.

gcc for x86_64 warns:

file.c: In function 'no_gvl_rename':
file.c:2886:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return (void *)rename(ra->src, ra->dst);
            ^
file.c: In function 'rb_file_s_rename':
file.c:2914:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     if ((int)rb_thread_call_without_gvl(no_gvl_rename, &ra,
         ^
#3

Updated by Anonymous about 2 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r60091.


NEWS: entries for GVL release in File and Dir

(more to come)

Also available in: Atom PDF