nvme: Remove calls to getpid() when submitting nvme requests
As of glibc version 2.3.4 onwards getpid() is no longer cached. SPDK
makes calls to it in nvme_allocate_request() which is called for each
nvme request received. This results in a system calls up to millions of
times per second which slows down nvme submissions. Since the pid never
changes, it only needs to be called once in initialization per process.
This improves the performance of nvme_allocate_request() signficantly.
Backported from master commit ce70f29662
Change-Id: I81b3d8d7f298db25c3f6c3e237e5f9d290c1f126
Signed-off-by: Jonathan Richardson <jonathan.richardson@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-on: https://review.gerrithub.io/407599
Reviewed-by: Scott Branden <sbranden@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-on: https://review.gerrithub.io/408406
This commit is contained in:
parent
1050ace333
commit
e5cfae172d
@ -39,6 +39,7 @@
|
||||
#define SPDK_NVME_DRIVER_NAME "spdk_nvme_driver"
|
||||
|
||||
struct nvme_driver *g_spdk_nvme_driver;
|
||||
static pid_t g_pid;
|
||||
|
||||
int32_t spdk_nvme_retry_count;
|
||||
|
||||
@ -128,7 +129,7 @@ nvme_allocate_request(struct spdk_nvme_qpair *qpair,
|
||||
req->payload = *payload;
|
||||
req->payload_size = payload_size;
|
||||
req->qpair = qpair;
|
||||
req->pid = getpid();
|
||||
req->pid = g_pid;
|
||||
|
||||
return req;
|
||||
}
|
||||
@ -259,6 +260,9 @@ nvme_driver_init(void)
|
||||
/* Any socket ID */
|
||||
int socket_id = -1;
|
||||
|
||||
/* Each process needs its own pid. */
|
||||
g_pid = getpid();
|
||||
|
||||
/*
|
||||
* Only one thread from one process will do this driver init work.
|
||||
* The primary process will reserve the shared memory and do the
|
||||
|
Loading…
Reference in New Issue
Block a user