sapling/eden/fs/utils/Thread.h
Chad Austin a31f57db1a disable pthread cancellation on the FuseChannel threads
Summary:
In glibc, pthread cancellation support adds two atomic CAS operations
to each "cancellation point" syscall (see pthreads(7)). This includes
read() and write(). We can avoid that overhead by disabling pthread
cancellation at the start of the FUSE worker threads.

This saves two CAS operations (~40 ns) in the critical FUSE request
processing loop.

Reviewed By: simpkins

Differential Revision: D21469690

fbshipit-source-id: 7f28a2a8e831006351657981e901dc572c58cf48
2020-05-08 20:41:50 -07:00

23 lines
589 B
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
namespace facebook {
namespace eden {
/**
* Disable pthread cancellation for the calling thread. This improves
* performance in glibc for cancellation point syscalls by avoiding two atomic
* CAS operations per syscall. See pthreads(7) for the list of functions that
* are defined to be cancellation points.
*/
void disablePthreadCancellation();
} // namespace eden
} // namespace facebook