Messages in this thread Patch in this message | | | From | Jia-Ju Bai <> | Subject | [PATCH] fs: dls: lowcomms: Replace GFP_ATOMIC with GFP_KERNEL in receive_from_sock | Date | Mon, 9 Apr 2018 22:31:43 +0800 |
| |
receive_from_sock() is never called in atomic context.
The call chain ending up at receive_from_sock() is: [1] receive_from_sock() <- process_recv_sockets() process_recv_sockets() is only set as a parameter of INIT_WORK() And receive_from_sock() also calls mutex_lock(), which indicates this function is not called in atomic context.
Despite never getting called from atomic context, receive_from_sock() calls alloc_page() with GFP_ATOMIC, which waits busily for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, to avoid busy waiting and improve the possibility of sucessful allocation.
This is found by a static analysis tool named DCNS written by myself. And I also manually check it.
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> --- fs/dlm/lowcomms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 4813d0e..2d4e230 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -633,7 +633,7 @@ static int receive_from_sock(struct connection *con) * This doesn't need to be atomic, but I think it should * improve performance if it is. */ - con->rx_page = alloc_page(GFP_ATOMIC); + con->rx_page = alloc_page(GFP_KERNEL); if (con->rx_page == NULL) goto out_resched; cbuf_init(&con->cb, PAGE_SIZE); -- 1.9.1
| |