Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1516336
| From | Joel Fernandes <joelaf@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 4/7] mm: defer vmalloc from atomic context |
| Date | 2016-11-07 18:00 +0100 |
| Message-ID | <sAVr4-5FZ-41@gated-at.bofh.it> (permalink) |
| References | <sv6fv-585-13@gated-at.bofh.it> <sv6fw-585-25@gated-at.bofh.it> <sA09r-2Ft-5@gated-at.bofh.it> <sA09r-2Ft-3@gated-at.bofh.it> <sATSh-4Pz-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Nov 7, 2016 at 7:01 AM, Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> On 11/05/2016 06:43 AM, Joel Fernandes wrote:
>> On Mon, Oct 24, 2016 at 8:44 AM, Andrey Ryabinin
>> <aryabinin@virtuozzo.com> wrote:
>>>
>>>
>>> On 10/22/2016 06:17 PM, Christoph Hellwig wrote:
>>>> We want to be able to use a sleeping lock for freeing vmap to keep
>>>> latency down. For this we need to use the deferred vfree mechanisms
>>>> no only from interrupt, but from any atomic context.
>>>>
>>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>>> ---
>>>> mm/vmalloc.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
>>>> index a4e2cec..bcc1a64 100644
>>>> --- a/mm/vmalloc.c
>>>> +++ b/mm/vmalloc.c
>>>> @@ -1509,7 +1509,7 @@ void vfree(const void *addr)
>>>>
>>>> if (!addr)
>>>> return;
>>>> - if (unlikely(in_interrupt())) {
>>>> + if (unlikely(in_atomic())) {
>>>
>>> in_atomic() cannot always detect atomic context, thus it shouldn't be used here.
>>> You can add something like vfree_in_atomic() and use it in atomic call sites.
>>>
>>
>> So because in_atomic doesn't work for !CONFIG_PREEMPT kernels, can we
>> always defer the work in these cases?
>>
>> So for non-preemptible kernels, we always defer:
>>
>> if (!IS_ENABLED(CONFIG_PREEMPT) || in_atomic()) {
>> // defer
>> }
>>
>> Is this fine? Or any other ideas?
>>
>
> What's wrong with my idea?
> We can add vfree_in_atomic() and use it to free vmapped stacks
> and for any other places where vfree() used 'in_atomict() && !in_interrupt()' context.
Yes, this sounds like a better idea as there may not be that many
callers and my idea may hurt perf.
Thanks,
Joel
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH 4/7] mm: defer vmalloc from atomic context Joel Fernandes <joelaf@google.com> - 2016-11-05 04:50 +0100 Re: [PATCH 4/7] mm: defer vmalloc from atomic context Christoph Hellwig <hch@lst.de> - 2016-11-07 16:20 +0100 Re: [PATCH 4/7] mm: defer vmalloc from atomic context Joel Fernandes <joelaf@google.com> - 2016-11-07 18:00 +0100
csiph-web