RFR: 8274113: (fc) Tune FileChannel.transferFrom() [v2]

Alan Bateman alanb at openjdk.java.net
Wed May 11 13:01:46 UTC 2022


On Tue, 10 May 2022 23:32:42 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> This request proposes to change `FileChannel.transferFrom()` to add a fast path on Linux and a threshold for mapped transfers on all platforms.
>
> Brian Burkhalter has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   8274113: (fc) Tune FileChannel.transferFrom()

src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java line 541:

> 539:     // set this to false if we find out later that it doesn't
> 540:     //
> 541:     private static volatile boolean transferToSupported = true;

At some point we need to invert these to transferXXXNotSupported so that the default is false rather true, maybe we should do it as part of this PR because all usages are changed anyway?

src/java.base/unix/native/libnio/ch/FileChannelImpl.c line 66:

> 64: {
> 65:     jlong pageSize = sysconf(_SC_PAGESIZE);
> 66:     chan_fd = (*env)->GetFieldID(env, clazz, "fd", "Ljava/io/FileDescriptor;");

At some point we need to remove chan_fd, instead map0 should provide the fd.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8644


More information about the nio-dev mailing list