]> git.baikalelectronics.ru Git - kernel.git/commit
mm: fix unexpected changes to {failslab|fail_page_alloc}.attr
authorQi Zheng <zhengqi.arch@bytedance.com>
Fri, 18 Nov 2022 10:00:11 +0000 (18:00 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 23 Nov 2022 02:50:44 +0000 (18:50 -0800)
commit663bd44e7b2e79ab1d0e1eadd1cdf2713dac5a7a
tree5789122b9ff301d81d2cc73e48300f01124bfe5a
parentbeab4407b4f03dc3bf4dd9c91cb6dbac6f24a6c4
mm: fix unexpected changes to {failslab|fail_page_alloc}.attr

When we specify __GFP_NOWARN, we only expect that no warnings will be
issued for current caller.  But in the __should_failslab() and
__should_fail_alloc_page(), the local GFP flags alter the global
{failslab|fail_page_alloc}.attr, which is persistent and shared by all
tasks.  This is not what we expected, let's fix it.

[akpm@linux-foundation.org: unexport should_fail_ex()]
Link: https://lkml.kernel.org/r/20221118100011.2634-1-zhengqi.arch@bytedance.com
Fixes: 73389b537ae2 ("mm: fix missing handler for __GFP_NOWARN")
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/fault-inject.h
lib/fault-inject.c
mm/failslab.c
mm/page_alloc.c