Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1501610

Re: [PATCH v2] mm: vmalloc: Replace purge_lock spinlock with atomic refcount

From Nicholas Piggin <npiggin@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] mm: vmalloc: Replace purge_lock spinlock with atomic refcount
Date 2016-10-17 06:10 +0200
Message-ID <st7pn-6SP-5@gated-at.bofh.it> (permalink)
References <ssuHo-6v5-21@gated-at.bofh.it>
Organization IBM

Show all headers | View raw


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,
Nick

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] mm: vmalloc: Replace purge_lock spinlock with atomic refcount Joel Fernandes <joelaf@google.com> - 2016-10-15 12:50 +0200
  Re: [PATCH v2] mm: vmalloc: Replace purge_lock spinlock with atomic  refcount Nicholas Piggin <npiggin@gmail.com> - 2016-10-17 06:10 +0200
    Re: [PATCH v2] mm: vmalloc: Replace purge_lock spinlock with atomic refcount Joel Fernandes <joelaf@google.com> - 2016-10-17 19:40 +0200

csiph-web