linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joelaf@google.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-rt-users@vger.kernel.org,
	Chris Wilson <chris@chris-wilson.co.uk>,
	Jisheng Zhang <jszhang@marvell.com>,
	John Dias <joaodias@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>
Subject: Re: [PATCH v2] mm: vmalloc: Replace purge_lock spinlock with atomic refcount
Date: Mon, 17 Oct 2016 10:34:51 -0700	[thread overview]
Message-ID: <CAJWu+oqg9vjit6=p24rYn3X0e4Z+TLLqn79AApoE1rTBNpbB1Q@mail.gmail.com> (raw)
In-Reply-To: <20161017150005.4c8f890d@roar.ozlabs.ibm.com>

Hi Nick,

On Sun, Oct 16, 2016 at 9:00 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
> On Sat, 15 Oct 2016 03:42:42 -0700
> Joel Fernandes <joelaf@google.com> wrote:
>
>> The purge_lock spinlock causes high latencies with non RT kernel. This has been
>> reported multiple times on lkml [1] [2] and affects applications like audio.
>>
>> In this patch, I replace the spinlock with an atomic refcount so that
>> preemption is kept turned on during purge. This Ok to do since [3] builds the
>> lazy free list in advance and atomically retrieves the list so any instance of
>> purge will have its own list it is purging. Since the individual vmap area
>> frees are themselves protected by a lock, this is Ok.
>
> This is a good idea, and good results, but that's not what the spinlock was
> for -- it was for enforcing the sync semantics.
>
> Going this route, you'll have to audit callers to expect changed behavior
> and change documentation of sync parameter.
>
> I suspect a better approach would be to instead use a mutex for this, and
> require that all sync=1 callers be able to sleep. I would say that most
> probably already can.

Thanks, I agree mutex is the right way to fix this.

Regards,
Joel

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2016-10-17 17:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15 10:42 Joel Fernandes
2016-10-17  2:22 ` [lkp] [mm] b1f58b69ba: BUG: sleeping function called from invalid context at mm/vmalloc.c:667 kernel test robot
2016-10-17  4:00 ` [PATCH v2] mm: vmalloc: Replace purge_lock spinlock with atomic refcount Nicholas Piggin
2016-10-17 17:34   ` Joel Fernandes [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='CAJWu+oqg9vjit6=p24rYn3X0e4Z+TLLqn79AApoE1rTBNpbB1Q@mail.gmail.com' \
    --to=joelaf@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=joaodias@google.com \
    --cc=jszhang@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=npiggin@gmail.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