From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm@linux-foundation.org, Mike Kravetz <mike.kravetz@oracle.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] mm/hugetlb: make hugetlb_lock irq safe
Date: Thu, 6 Sep 2018 09:30:02 +0530 [thread overview]
Message-ID: <95b9a5d9-1e46-b969-4188-14c0a6efb215@linux.ibm.com> (raw)
In-Reply-To: <20180905134848.GB3729@bombadil.infradead.org>
On 09/05/2018 07:18 PM, Matthew Wilcox wrote:
> On Wed, Sep 05, 2018 at 06:56:19PM +0530, Aneesh Kumar K.V wrote:
>> On 09/05/2018 06:34 PM, Matthew Wilcox wrote:
>>> On Wed, Sep 05, 2018 at 04:53:41PM +0530, Aneesh Kumar K.V wrote:
>>>> inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
>>>
>>> How do you go from "can be taken in softirq context" problem report to
>>> "must disable hard interrupts" solution? Please explain why spin_lock_bh()
>>> is not a sufficient fix.
>>>
>>>> swapper/68/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
>>>> 0000000052a030a7 (hugetlb_lock){+.?.}, at: free_huge_page+0x9c/0x340
>>>> {SOFTIRQ-ON-W} state was registered at:
>>>> lock_acquire+0xd4/0x230
>>>> _raw_spin_lock+0x44/0x70
>>>> set_max_huge_pages+0x4c/0x360
>>>> hugetlb_sysctl_handler_common+0x108/0x160
>>>> proc_sys_call_handler+0x134/0x190
>>>> __vfs_write+0x3c/0x1f0
>>>> vfs_write+0xd8/0x220
>>>
>>> Also, this only seems to trigger here. Is it possible we _already_
>>> have softirqs disabled through every other code path, and it's just this
>>> one sysctl handler that needs to disable softirqs? Rather than every
>>> lock access?
>>
>> Are you asking whether I looked at moving that put_page to a worker thread?
>
> No. I'm asking "why not disable softirqs in the sysctl handler". Or
> perhaps equivalently, just replace spin_lock() with spin_lock_bh() in
> set_max_huge_pages().
>
Disabling only in sysctl handler is not enough right? Every usage of
locks taken by the page destructor need to be converted to disable
softirqs right?
>> I didn't. The reason I looked at current patch is to enable the usage of
>> put_page() from irq context. We do allow that for non hugetlb pages. So was
>> not sure adding that additional restriction for hugetlb
>> is really needed. Further the conversion to irqsave/irqrestore was
>> straightforward.
>
> straightforward, sure. but is it the right thing to do? do we want to
> be able to put_page() a hugetlb page from hardirq context?
>
-aneesh
prev parent reply other threads:[~2018-09-06 4:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-05 11:23 [RFC PATCH] mm/hugetlb: make hugetlb_lock irq safe Aneesh Kumar K.V
2018-09-05 13:04 ` Matthew Wilcox
2018-09-05 13:26 ` Aneesh Kumar K.V
2018-09-05 13:48 ` Matthew Wilcox
2018-09-05 19:58 ` Andrew Morton
2018-09-05 21:35 ` Mike Kravetz
2018-09-05 22:00 ` Andrew Morton
2018-09-05 23:07 ` Matthew Wilcox
2018-09-05 23:51 ` Mike Kravetz
2018-09-06 4:03 ` Aneesh Kumar K.V
2018-09-06 11:19 ` Michal Hocko
2018-09-06 3:58 ` Aneesh Kumar K.V
2018-09-06 3:54 ` Aneesh Kumar K.V
2018-09-06 4:00 ` Aneesh Kumar K.V [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=95b9a5d9-1e46-b969-4188-14c0a6efb215@linux.ibm.com \
--to=aneesh.kumar@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=willy@infradead.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).