]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
fs: quota: Replace GFP_ATOMIC with GFP_KERNEL in dquot_init
authorJia-Ju Bai <baijiaju1990@gmail.com>
Mon, 9 Apr 2018 14:31:19 +0000 (22:31 +0800)
committerJan Kara <jack@suse.cz>
Mon, 9 Apr 2018 15:48:54 +0000 (17:48 +0200)
dquot_init() is never called in atomic context.
This function is only set as a parameter of fs_initcall().

Despite never getting called from atomic context,
dquot_init() calls __get_free_pages() 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>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/quota/dquot.c

index 020c597ef9b6e66a74f786d70302238d32dc729a..d88231e3b2be3ec1bc1f85c3c2fd92973e312c15 100644 (file)
@@ -2966,7 +2966,7 @@ static int __init dquot_init(void)
                        NULL);
 
        order = 0;
-       dquot_hash = (struct hlist_head *)__get_free_pages(GFP_ATOMIC, order);
+       dquot_hash = (struct hlist_head *)__get_free_pages(GFP_KERNEL, order);
        if (!dquot_hash)
                panic("Cannot create dquot hash table");