]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'fs-file-descriptor-optimization'
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 2 Nov 2015 00:43:24 +0000 (16:43 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 2 Nov 2015 00:43:24 +0000 (16:43 -0800)
commitdd644181efac56acb0a02a6ca0148983a8c1e3c1
tree4c6feb1e7a10d602ef7c3f9e017cad48e52cc8a1
parent604540cf17d16376c012a4e2b668db6756bd925f
parentbac53b8a736b9fc86326a772ef3b0c4921861620
Merge branch 'fs-file-descriptor-optimization'

Merge file descriptor allocation speedup.

Eric Dumazet has a test-case for a fairly common network deamon load
pattern: openign and closing a lot of sockets that each have very little
work done on them.  It turns out that in that case, the cost of just
finding the correct file descriptor number can be a dominating factor.

We've long had a trivial optimization for allocating file descriptors
sequentially, but that optimization ends up being not very effective
when other file descriptors are being closed concurrently, and the fd
patterns are not some simple FIFO pattern.  In such cases we ended up
spending a lot of time just scanning the bitmap of open file descriptors
in order to find the next file descriptor number to open.

This trivial patch-series mitigates that by simply introducing a
second-level bitmap of which words in the first bitmap are already fully
allocated.  That cuts down the cost of scanning by an order of magnitude
in some pathological (but realistic) cases.

The second patch is an even more trivial patch to avoid unnecessarily
dirtying the cacheline for the close-on-exec bit array that normally
ends up being all empty.

* fs-file-descriptor-optimization:
  vfs: conditionally clear close-on-exec flag
  vfs: Fix pathological performance case for __alloc_fd()