fuse: add numa affinity for uring queues
Subsystems (3)
Joanne Koong
maintainerPATCH 1/1 fuse: add numa affinity for uring queues
There is a 1:1 mapping between cpus and queues. Allocate the queue on the numa node associated with the cpu to help reduce memory access latencies.
--- fs/fuse/dev_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/dev_uring.c +1 -1
@@ -256,7 +256,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring,struct fuse_ring_queue *queue;struct list_head *pq; - queue =kzalloc (sizeof (*queue),GFP_KERNEL_ACCOUNT ); + queue =kzalloc_node (sizeof (*queue),GFP_KERNEL_ACCOUNT ,cpu_to_node (qid));if (!queue)return NULL ; pq =kcalloc (FUSE_PQ_HASH_SIZE ,sizeof (struct list_head ),GFP_KERNEL );
Signature · 1 line
2.47.1
Joanne Koong
maintainerQuoted 15 lines · Joanne Koong
There is a 1:1 mapping between cpus and queues. Allocate the queue on the numa node associated with the cpu to help reduce memory access latencies.
Signed-off-by Joanne Koong <[email protected]>--- fs/fuse/dev_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/fuse/dev_uring.c +0
-0
fs/fuse/dev_uring.c static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, · line 262
Quoted 8 lines
fs/fuse/dev_uring.c +1
-1@@ -256,7 +256,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring,struct fuse_ring_queue *queue;struct list_head *pq; - queue =kzalloc (sizeof (*queue),GFP_KERNEL_ACCOUNT ); + queue =kzalloc_node (sizeof (*queue),GFP_KERNEL_ACCOUNT ,cpu_to_node (qid));if (!queue)return NULL ; pq =kcalloc (FUSE_PQ_HASH_SIZE ,sizeof (struct list_head ),GFP_KERNEL );
On the same note I guess we should also allocate pq on the corresponding numa node too.
Quoted 3 lines
--
2.47.1
Quoted 19 lines · Joanne Koong
Quoted 18 lines · Joanne Koong
There is a 1:1 mapping between cpus and queues. Allocate the queue on the numa node associated with the cpu to help reduce memory access latencies.
Signed-off-by Joanne Koong <[email protected]>--- fs/fuse/dev_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/fuse/dev_uring.c +0
-0@@ -256,7 +256,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring,struct fuse_ring_queue *queue;struct list_head *pq;
Quoted 8 lines
fs/fuse/dev_uring.c static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, · line 262
Quoted 5 lines
fs/fuse/dev_uring.c +1
-1- queue =kzalloc (sizeof (*queue),GFP_KERNEL_ACCOUNT ); + queue =kzalloc_node (sizeof (*queue),GFP_KERNEL_ACCOUNT ,cpu_to_node (qid));if (!queue)return NULL ; pq =kcalloc (FUSE_PQ_HASH_SIZE ,sizeof (struct list_head ),GFP_KERNEL );On the same note I guess we should also allocate pq on the corresponding numa node too.
So this is supposed to be called from a thread that already runs on this numa node and then kmalloc will allocate anyway on the right node, afaik. Do you have a use case where this is called from another node? If you do, all allocations in this file should be changed.
Thanks,
Bernd
Joanne Koong
maintainerQuoted 30 lines · Bernd Schubert
Quoted 19 lines · Joanne Koong
Quoted 18 lines · Joanne Koong
There is a 1:1 mapping between cpus and queues. Allocate the queue on the numa node associated with the cpu to help reduce memory access latencies.
Signed-off-by Joanne Koong <[email protected]>--- fs/fuse/dev_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/fuse/dev_uring.c +0
-0@@ -256,7 +256,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring,struct fuse_ring_queue *queue;struct list_head *pq;Quoted 8 lines
fs/fuse/dev_uring.c static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, · line 262
Quoted 5 lines
fs/fuse/dev_uring.c +1
-1- queue =kzalloc (sizeof (*queue),GFP_KERNEL_ACCOUNT ); + queue =kzalloc_node (sizeof (*queue),GFP_KERNEL_ACCOUNT ,cpu_to_node (qid));if (!queue)return NULL ; pq =kcalloc (FUSE_PQ_HASH_SIZE ,sizeof (struct list_head ),GFP_KERNEL );On the same note I guess we should also allocate pq on the corresponding numa node too.
Quoted 5 lines
So this is supposed to be called from a thread that already runs on this numa node and then kmalloc will allocate anyway on the right node, afaik. Do you have a use case where this is called from another node? If you do, all allocations in this file should be changed.
I don't have a use case I'm using but imo it seems hardier to ensure this at the kernel level for queue, pq, and ent allocations instead of assuming userspace will always submit the registration from the thread on the numa node corresponding to the qid it's registering. I don't feel strongly about this though so if you think the responsibility should be left to userspace, then that's fine with me.
Thanks,
Joanne
Quoted 3 lines
Thanks,
Bernd
Joanne Koong
maintainerQuoted 39 lines · Joanne Koong
Quoted 30 lines · Bernd Schubert
Quoted 19 lines · Joanne Koong
Quoted 18 lines · Joanne Koong
There is a 1:1 mapping between cpus and queues. Allocate the queue on the numa node associated with the cpu to help reduce memory access latencies.
Signed-off-by Joanne Koong <[email protected]>--- fs/fuse/dev_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/fuse/dev_uring.c +0
-0@@ -256,7 +256,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring,struct fuse_ring_queue *queue;struct list_head *pq;Quoted 8 lines
fs/fuse/dev_uring.c static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, · line 262
Quoted 5 lines
fs/fuse/dev_uring.c +1
-1- queue =kzalloc (sizeof (*queue),GFP_KERNEL_ACCOUNT ); + queue =kzalloc_node (sizeof (*queue),GFP_KERNEL_ACCOUNT ,cpu_to_node (qid));if (!queue)return NULL ; pq =kcalloc (FUSE_PQ_HASH_SIZE ,sizeof (struct list_head ),GFP_KERNEL );On the same note I guess we should also allocate pq on the corresponding numa node too.
Quoted 5 lines
So this is supposed to be called from a thread that already runs on this numa node and then kmalloc will allocate anyway on the right node, afaik. Do you have a use case where this is called from another node? If you do, all allocations in this file should be changed.
Quoted 6 lines
I don't have a use case I'm using but imo it seems hardier to ensure this at the kernel level for queue, pq, and ent allocations instead of assuming userspace will always submit the registration from the thread on the numa node corresponding to the qid it's registering. I don't feel strongly about this though so if you think the responsibility should be left to userspace, then that's fine with me.
Thinking about this some more, if the responsibility for numa affinity should be left to userspace, then that should hold true too for configurable queues, no?
Thanks,
Joanne
Quoted 7 lines
Thanks,
JoanneQuoted 3 lines
Thanks,
Bernd
Quoted 38 lines · Joanne Koong
Quoted 30 lines · Bernd Schubert
Quoted 19 lines · Joanne Koong
Quoted 18 lines · Joanne Koong
There is a 1:1 mapping between cpus and queues. Allocate the queue on the numa node associated with the cpu to help reduce memory access latencies.
Signed-off-by Joanne Koong <[email protected]>--- fs/fuse/dev_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/fuse/dev_uring.c +0
-0@@ -256,7 +256,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring,struct fuse_ring_queue *queue;struct list_head *pq;Quoted 8 lines
fs/fuse/dev_uring.c static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, · line 262
Quoted 5 lines
fs/fuse/dev_uring.c +1
-1- queue =kzalloc (sizeof (*queue),GFP_KERNEL_ACCOUNT ); + queue =kzalloc_node (sizeof (*queue),GFP_KERNEL_ACCOUNT ,cpu_to_node (qid));if (!queue)return NULL ; pq =kcalloc (FUSE_PQ_HASH_SIZE ,sizeof (struct list_head ),GFP_KERNEL );On the same note I guess we should also allocate pq on the corresponding numa node too.
Quoted 5 lines
So this is supposed to be called from a thread that already runs on this numa node and then kmalloc will allocate anyway on the right node, afaik. Do you have a use case where this is called from another node? If you do, all allocations in this file should be changed.
Quoted 7 lines
I don't have a use case I'm using but imo it seems hardier to ensure this at the kernel level for queue, pq, and ent allocations instead of assuming userspace will always submit the registration from the thread on the numa node corresponding to the qid it's registering. I don't feel strongly about this though so if you think the responsibility should be left to userspace, then that's fine with me.
What I basically mean is that these threads are going to send the initial SQE, shouldn't it? Sounds a bit weird to me if the setup and sending the registration SQE are from different threads than the later handling.
Thanks,
Bernd