From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: Christopher Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
akpm@linux-foundation.org, linux-mm@kvack.org,
Mel Gorman <mgorman@techsingularity.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Can kfree() sleep at runtime?
Date: Fri, 1 Jun 2018 09:18:45 +0800 [thread overview]
Message-ID: <3b65993d-9e96-4354-8761-ae1f87c5ae20@gmail.com> (raw)
In-Reply-To: <01000163b6883743-79e003fa-71c2-4e9d-aa4a-35fcd08bb0d8-000000@email.amazonses.com>
On 2018/5/31 22:09, Christopher Lameter wrote:
> On Thu, 31 May 2018, Jia-Ju Bai wrote:
>
>> I write a static analysis tool (DSAC), and it finds that kfree() can sleep.
> That should not happen.
>
>> Here is the call path for kfree().
>> Please look at it *from the bottom up*.
>>
>> [FUNC] alloc_pages(GFP_KERNEL)
>> arch/x86/mm/pageattr.c, 756: alloc_pages in split_large_page
>> arch/x86/mm/pageattr.c, 1283: split_large_page in __change_page_attr
>> arch/x86/mm/pageattr.c, 1391: __change_page_attr in __change_page_attr_set_clr
>> arch/x86/mm/pageattr.c, 2014: __change_page_attr_set_clr in __set_pages_np
>> arch/x86/mm/pageattr.c, 2034: __set_pages_np in __kernel_map_pages
>> ./include/linux/mm.h, 2488: __kernel_map_pages in kernel_map_pages
>> mm/page_alloc.c, 1074: kernel_map_pages in free_pages_prepare
> mapping pages in the page allocator can cause allocations?? How did that
> get in there?
Thanks for reply :)
I am also confused about it.
I get in here according to the definition of free_pages_prepare():
1022. static bool free_pages_prepare(...) {
...
1072. arch_free_page(page, order);
1073. kernel_poison_pages(page, 1 << order, 0);
1074. kernel_map_pages(page, 1 << order, 0); // *Here*
1075. kasan_free_pages(page, order);
1076.
1077. return true;
1078. }
Best wishes,
Jia-Ju Bai
prev parent reply other threads:[~2018-06-01 1:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-31 13:10 Jia-Ju Bai
2018-05-31 14:08 ` Matthew Wilcox
2018-05-31 14:12 ` Christopher Lameter
2018-05-31 14:14 ` Matthew Wilcox
2018-05-31 14:30 ` Christopher Lameter
2018-06-01 1:22 ` Jia-Ju Bai
2018-06-01 1:34 ` Nadav Amit
2018-06-01 1:12 ` Jia-Ju Bai
2018-05-31 14:09 ` Christopher Lameter
2018-06-01 1:18 ` Jia-Ju Bai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3b65993d-9e96-4354-8761-ae1f87c5ae20@gmail.com \
--to=baijiaju1990@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox