linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Luca Barbieri <luca@luca-barbieri.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: (arch_)get_unmapped_area can be terribly slow due to unnecessary linear search and find_vma
Date: Mon, 30 Aug 2010 23:28:21 +0200	[thread overview]
Message-ID: <AANLkTi=4k0tc2ofwU0XLUn6Az3FhXrTex_EK4Ny-vJVM@mail.gmail.com> (raw)

[Sending copy of bug #17531 since the BTS seemingly can't/won't send it to LKML]

Currently most/all versions of get_unmapped_area perform a linear search in the
process virtual address space to find free space.

Some, like arch_get_unmapped_area_topdown for x86-64 even call find_vma for
each step, which does a full walk on the rb-tree of vmas.

Instead, they should use, from slower to faster:
- O(n) but faster: a linked list of virtual address space holes
- O(log(n)): an rb-tree of virtual address space holes indexed by size
- O(1): a buddy allocator of virtual address space holes, or another scheme
with buckets

Is there any reason this issue hasn't been fixed yet? (i.e. any reason none of
the proposed schemes are feasible?)

Workloads doing a lot of mmaps tend to suffer greatly, especially on the
versions that do a find_vma for each step of the scan.

An example are OpenGL drivers using DRM/GEM/TTM who don't employ userspace
caching and suballocation of TTM allocated buffers.

--
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:[~2010-08-30 21:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='AANLkTi=4k0tc2ofwU0XLUn6Az3FhXrTex_EK4Ny-vJVM@mail.gmail.com' \
    --to=luca@luca-barbieri.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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).