From: Fuqian Huang <huangfq.daxian@gmail.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Is it safe to kmalloc a large size of memory in interrupt handler?
Date: Mon, 5 Aug 2019 19:57:54 +0800 [thread overview]
Message-ID: <CABXRUiSuZc+W7884ek9YifKdx1eiJ_pmyRM42KK0ZhSK9xTkFw@mail.gmail.com> (raw)
In the implementation of kmalloc.
when the allocated size is larger than KMALLOC_MAX_CACHE_SIZE,
it will call kmalloc_large to allocate the memory.
kmalloc_large ->
kmalloc_order_trace->kmalloc_order->alloc_pages->alloc_pages_current->alloc_pages_nodemask->get_page_from_freelist->node_reclaim->__node_reclaim->shrink_node->shrink_node_memcg->get_scan_count
get_scan_count will call spin_unlock_irq which enables local interrupt.
As the local interrupt should be disabled in the interrupt handler.
It is safe to use kmalloc to allocate a large size of memory in
interrupt handler?
next reply other threads:[~2019-08-05 11:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 11:57 Fuqian Huang [this message]
2019-08-05 12:13 ` Is it safe to kmalloc a large size of memory in interrupt handler? Michal Hocko
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=CABXRUiSuZc+W7884ek9YifKdx1eiJ_pmyRM42KK0ZhSK9xTkFw@mail.gmail.com \
--to=huangfq.daxian@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).