From: Waiman Long <longman@redhat.com>
To: Mike Kravetz <mike.kravetz@oracle.com>,
Michal Hocko <mhocko@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Matthew Wilcox <willy@infradead.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
aneesh.kumar@linux.ibm.com
Subject: Re: [PATCH v2] mm/hugetlb: defer free_huge_page() to a workqueue
Date: Mon, 16 Dec 2019 14:13:40 -0500 [thread overview]
Message-ID: <17e326a7-093a-dbd3-8e6e-232ec9b81b9e@redhat.com> (raw)
In-Reply-To: <68d466cc-2cbd-ae49-7d89-e7476c5a9c24@oracle.com>
On 12/16/19 2:08 PM, Mike Kravetz wrote:
> On 12/16/19 8:17 AM, Davidlohr Bueso wrote:
>> On Mon, 16 Dec 2019, Michal Hocko wrote:
>>> I am afraid that work_struct is too large to be stuffed into the struct
>>> page array (because of the lockdep part).
>> Yeah, this needs to be done without touching struct page.
>>
>> Which is why I had done the stack allocated way in this patch, but we
>> cannot wait for it to complete in irq, so that's out the window. Andi
>> had suggested percpu allocated work items, but having played with the
>> idea over the weekend, I don't see how we can prevent another page being
>> freed on the same cpu before previous work on the same cpu is complete
>> (cpu0 wants to free pageA, schedules the work, in the mean time cpu0
>> wants to free pageB and workerfn for pageA still hasn't been called).
>>
>>> I think that it would be just safer to make hugetlb_lock irq safe. Are
>>> there any other locks that would require the same?
>> It would be simpler. Any performance issues that arise would probably
>> be only seen in microbenchmarks, assuming we want to have full irq safety.
>> If we don't need to worry about hardirq, then even better.
>>
>> The subpool lock would also need to be irq safe.
> I do think we need to worry about hardirq. There are no restruictions that
> put_page can not be called from hardirq context.
>
> I am concerned about the latency of making hugetlb_lock (and potentially
> subpool lock) hardirq safe. When these locks were introduced (before my
> time) the concept of making them irq safe was not considered. Recently,
> I learned that the hugetlb_lock is held for a linear scan of ALL hugetlb
> pages during a cgroup reparentling operation. That is just too long.
>
> If there is no viable work queue solution, then I think we would like to
> restructure the hugetlb locking before a change to just make hugetlb_lock
> irq safe. The idea would be to split the scope of what is done under
> hugetlb_lock. Most of it would never be executed in irq context. Then
> have a small/limited set of functionality that really needs to be irq
> safe protected by an irq safe lock.
>
Please take a look at my recently posted patch to see if that is an
acceptable workqueue based solution.
Thanks,
Longman
next prev parent reply other threads:[~2019-12-16 19:13 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 19:46 [PATCH v2] hugetlbfs: Disable softIRQ when taking hugetlb_lock Waiman Long
2019-12-11 22:04 ` Mike Kravetz
2019-12-11 22:19 ` Waiman Long
2019-12-12 1:11 ` Mike Kravetz
2019-12-12 6:06 ` Davidlohr Bueso
2019-12-12 6:30 ` Davidlohr Bueso
2019-12-12 19:04 ` [PATCH v2] mm/hugetlb: defer free_huge_page() to a workqueue Davidlohr Bueso
2019-12-12 19:22 ` Mike Kravetz
2019-12-12 19:36 ` Davidlohr Bueso
2019-12-12 20:52 ` Waiman Long
2019-12-12 21:04 ` Waiman Long
2019-12-16 13:26 ` Michal Hocko
2019-12-16 15:38 ` Waiman Long
2019-12-16 18:44 ` Waiman Long
2019-12-17 9:00 ` Michal Hocko
2019-12-17 18:05 ` Mike Kravetz
2019-12-18 12:18 ` hugetlbfs testing coverage (was: Re: [PATCH v2] mm/hugetlb: defer free_huge_page() to a workqueue) Michal Hocko
2019-12-12 21:01 ` [PATCH v2] mm/hugetlb: defer free_huge_page() to a workqueue Waiman Long
2019-12-16 13:37 ` Michal Hocko
2019-12-16 16:17 ` Waiman Long
2019-12-16 16:17 ` Davidlohr Bueso
2019-12-16 17:18 ` Matthew Wilcox
2019-12-16 19:08 ` Mike Kravetz
2019-12-16 19:13 ` Waiman Long [this message]
2019-12-12 21:32 ` [PATCH v2] hugetlbfs: Disable softIRQ when taking hugetlb_lock Andi Kleen
2019-12-12 22:42 ` Davidlohr Bueso
2019-12-11 23:05 ` Andi Kleen
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=17e326a7-093a-dbd3-8e6e-232ec9b81b9e@redhat.com \
--to=longman@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.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).