Michael S. Tsirkin
f83f12d660
vsock/virtio: fix src/dst cid format
...
These fields are 64 bit, using le32_to_cpu and friends
on these will not do the right thing.
Fix this up.
Cc: stable@vger.kernel.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:59:19 +02:00
Michael S. Tsirkin
819483d806
vsock/virtio: mark an internal function static
...
virtio_transport_alloc_pkt is only used locally, make it static.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:59:19 +02:00
Michael S. Tsirkin
6c7efafdd5
vsock/virtio: add a missing __le annotation
...
guest cid is read from config space, therefore it's in little endian
format and is treated as such, annotate it accordingly.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:59:18 +02:00
Michael S. Tsirkin
72952cc061
vhost: add missing __user annotations
...
Several vhost functions were missing __user annotations
on pointers, causing sparse warnings. Fix this up.
sparse also warns about vhost_process_iotlb_msg which
is local and should be static. Fix that up as well.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:59:18 +02:00
Michael S. Tsirkin
2f952c0105
vhost: make interval tree static inline
...
vhost_umem_interval_tree is only used locally within vhost.c, mark it
static. As some functions generated go unused, this triggers warnings
unless we also mark it inline.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:59:17 +02:00
Michael S. Tsirkin
3373755a41
drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked
...
virtio_gpu_queue_ctrl_buffer_locked is called with ctrlq.qlock taken, it
releases and acquires this lock. This causes a sparse warning. Add
appropriate annotations for sparse context checking.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:59:17 +02:00
Michael S. Tsirkin
f862e60f8d
drm/virtio: fix lock context imbalance
...
When virtio_gpu_free_vbufs exits due to list empty, it does not
drop the free_vbufs lock that it took.
list empty is not expected to happen anyway, but it can't hurt to fix
this and drop the lock.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:59:16 +02:00
Michael S. Tsirkin
8854a56f3e
drm/virtio: fix endianness in primary_plane_update
...
virtio_gpu_cmd_transfer_to_host_2d expects x and y
parameters in LE, but virtio_gpu_primary_plane_update
passes in the CPU format instead.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:59:16 +02:00
Michael S. Tsirkin
7328fa64aa
virtio_console: drop unused config fields
...
struct ports_device includes a config field including the whole
virtio_console_config, but only max_nr_ports in there is ever updated or
used. The rest is unused and in fact does not even mirror the
device config. Drop everything except max_nr_ports,
saving some memory.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Reviewed-by: Jason Wang <jasowang@redhat.com >
2016-12-15 06:59:15 +02:00
Gonglei
c60923cb9c
virtio_ring: fix complaint by sparse
...
# make C=2 CF="-D__CHECK_ENDIAN__" ./drivers/virtio/
drivers/virtio/virtio_ring.c:423:19: warning: incorrect type in assignment (different base types)
drivers/virtio/virtio_ring.c:423:19: expected unsigned int [unsigned] [assigned] i
drivers/virtio/virtio_ring.c:423:19: got restricted __virtio16 [usertype] next
drivers/virtio/virtio_ring.c:423:19: warning: incorrect type in assignment (different base types)
drivers/virtio/virtio_ring.c:423:19: expected unsigned int [unsigned] [assigned] i
drivers/virtio/virtio_ring.c:423:19: got restricted __virtio16 [usertype] next
drivers/virtio/virtio_ring.c:423:19: warning: incorrect type in assignment (different base types)
drivers/virtio/virtio_ring.c:423:19: expected unsigned int [unsigned] [assigned] i
drivers/virtio/virtio_ring.c:423:19: got restricted __virtio16 [usertype] next
drivers/virtio/virtio_ring.c:604:39: warning: incorrect type in initializer (different base types)
drivers/virtio/virtio_ring.c:604:39: expected unsigned short [unsigned] [usertype] nextflag
drivers/virtio/virtio_ring.c:604:39: got restricted __virtio16
drivers/virtio/virtio_ring.c:612:33: warning: restricted __virtio16 degrades to integer
Signed-off-by: Gonglei <arei.gonglei@huawei.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:39:47 +02:00
Gonglei
61bd405f4e
virtio_pci_modern: fix complaint by sparse
...
drivers/virtio/virtio_pci_modern.c:66:40: warning: incorrect type in argument 2 (different base types)
drivers/virtio/virtio_pci_modern.c:66:40: expected unsigned int [noderef] [usertype] <asn:2>*addr
drivers/virtio/virtio_pci_modern.c:66:40: got restricted __le32 [noderef] [usertype] <asn:2>*lo
drivers/virtio/virtio_pci_modern.c:67:33: warning: incorrect type in argument 2 (different base types)
drivers/virtio/virtio_pci_modern.c:67:33: expected unsigned int [noderef] [usertype] <asn:2>*addr
drivers/virtio/virtio_pci_modern.c:67:33: got restricted __le32 [noderef] [usertype] <asn:2>*hi
drivers/virtio/virtio_pci_modern.c:150:32: warning: incorrect type in argument 2 (different base types)
drivers/virtio/virtio_pci_modern.c:150:32: expected unsigned int [noderef] [usertype] <asn:2>*addr
drivers/virtio/virtio_pci_modern.c:150:32: got restricted __le32 [noderef] <asn:2>*<noident>
drivers/virtio/virtio_pci_modern.c:151:39: warning: incorrect type in argument 1 (different base types)
drivers/virtio/virtio_pci_modern.c:151:39: expected unsigned int [noderef] [usertype] <asn:2>*addr
drivers/virtio/virtio_pci_modern.c:151:39: got restricted __le32 [noderef] <asn:2>*<noident>
drivers/virtio/virtio_pci_modern.c:152:32: warning: incorrect type in argument 2 (different base types)
drivers/virtio/virtio_pci_modern.c:152:32: expected unsigned int [noderef] [usertype] <asn:2>*addr
Signed-off-by: Gonglei <arei.gonglei@huawei.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
2016-12-15 06:39:46 +02:00
Linus Torvalds
a57cb1c1d7
Merge branch 'akpm' (patches from Andrew)
...
Merge more updates from Andrew Morton:
- a few misc things
- kexec updates
- DMA-mapping updates to better support networking DMA operations
- IPC updates
- various MM changes to improve DAX fault handling
- lots of radix-tree changes, mainly to the test suite. All leading up
to reimplementing the IDA/IDR code to be a wrapper layer over the
radix-tree. However the final trigger-pulling patch is held off for
4.11.
* emailed patches from Andrew Morton <akpm@linux-foundation.org >: (114 commits)
radix tree test suite: delete unused rcupdate.c
radix tree test suite: add new tag check
radix-tree: ensure counts are initialised
radix tree test suite: cache recently freed objects
radix tree test suite: add some more functionality
idr: reduce the number of bits per level from 8 to 6
rxrpc: abstract away knowledge of IDR internals
tpm: use idr_find(), not idr_find_slowpath()
idr: add ida_is_empty
radix tree test suite: check multiorder iteration
radix-tree: fix replacement for multiorder entries
radix-tree: add radix_tree_split_preload()
radix-tree: add radix_tree_split
radix-tree: add radix_tree_join
radix-tree: delete radix_tree_range_tag_if_tagged()
radix-tree: delete radix_tree_locate_item()
radix-tree: improve multiorder iterators
btrfs: fix race in btrfs_free_dummy_fs_info()
radix-tree: improve dump output
radix-tree: make radix_tree_find_next_bit more useful
...
2016-12-14 17:25:18 -08:00
Linus Torvalds
cf1b3341af
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
...
Pull block IO fixes from Jens Axboe:
"A few fixes that I collected as post-merge.
I was going to wait a bit with sending this out, but the O_DIRECT fix
should really go in sooner rather than later"
* 'for-linus' of git://git.kernel.dk/linux-block:
blk-mq: Fix failed allocation path when mapping queues
blk-mq: Avoid memory reclaim when remapping queues
block_dev: don't update file access position for sync direct IO
nvme/pci: Log PCI_STATUS when the controller dies
block_dev: don't test bdev->bd_contains when it is not stable
2016-12-14 17:21:53 -08:00
Linus Torvalds
80eabba702
Merge branch 'for-4.10/fs-unmap' of git://git.kernel.dk/linux-block
...
Pull fs meta data unmap optimization from Jens Axboe:
"A series from Jan Kara, providing a more efficient way for unmapping
meta data from in the buffer cache than doing it block-by-block.
Provide a general helper that existing callers can use"
* 'for-4.10/fs-unmap' of git://git.kernel.dk/linux-block:
fs: Remove unmap_underlying_metadata
fs: Add helper to clean bdev aliases under a bh and use it
ext2: Use clean_bdev_aliases() instead of iteration
ext4: Use clean_bdev_aliases() instead of iteration
direct-io: Use clean_bdev_aliases() instead of handmade iteration
fs: Provide function to unmap metadata for a range of blocks
2016-12-14 17:09:00 -08:00
Linus Torvalds
852d21ae1f
docs: add back 'Documentation/Changes' file (as symlink)
...
Jaegeuk Kim reports that the debian kernel package build gets confused
by the lack of Documentation/Changes file. We also refer to that path
name in ver_linux and various how-to files and Kconfig files.
The file got renamed away in commit 186128f753 ("docs-rst: add
documents to development-process"), and as Jaegeuk Kim points out, the
commit message for that change says "use symlinks instead of renames",
but then the commit itself actually does renames after all.
Maybe we should do the other files too, but for now this just adds the
minimal symlink back to the historical name, so that people looking for
Documentation/Changes will actually find what they are looking for, and
the debian scripts continue to work.
Reported-by: Jaegeuk Kim <jaegeuk@kernel.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:30:12 -08:00
Matthew Wilcox
e1e14ab841
radix tree test suite: delete unused rcupdate.c
...
This file was used to implement call_rcu() before liburcu implemented
that function. It hasn't even been compiled since before the test suite
was added to the kernel. Remove it to reduce confusion.
Link: http://lkml.kernel.org/r/1481667692-14500-5-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
092bc0b225
radix tree test suite: add new tag check
...
We have a check that setting a tag on a single entry at root succeeds,
but we were missing a check that clearing a tag on that same entry also
succeeds.
Link: http://lkml.kernel.org/r/1481667692-14500-4-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
e8de434076
radix-tree: ensure counts are initialised
...
radix_tree_join() was freeing nodes with a non-zero ->exceptional count,
and radix_tree_split() wasn't zeroing ->exceptional when it allocated
the new node. Fix this by making all callers of radix_tree_node_alloc()
pass in the new counts (and some other always-initialised fields), which
will prevent the problem recurring if in future we decide to do
something similar.
Link: http://lkml.kernel.org/r/1481667692-14500-3-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
bbe9d71f2c
radix tree test suite: cache recently freed objects
...
The kmem_cache_alloc implementation simply allocates new memory from
malloc() and calls the ctor, which zeroes out the entire object. This
means it cannot spot bugs where the object isn't properly reinitialised
before being freed.
Add a small (11 objects) cache before freeing objects back to malloc.
This is enough to let us write a test to catch it, although the memory
allocator is now aware of the structure of the radix tree node, since it
chains free objects through ->private_data (like the percpu cache does).
Link: http://lkml.kernel.org/r/1481667692-14500-2-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
de1af8f62a
radix tree test suite: add some more functionality
...
IDR needs more functionality from the kernel: kmalloc()/kfree(), and
xchg().
Link: http://lkml.kernel.org/r/1480369871-5271-67-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
424251a4a9
idr: reduce the number of bits per level from 8 to 6
...
In preparation for merging the IDR and radix tree, reduce the fanout at
each level from 256 to 64. If this causes a performance problem then a
bisect will point to this commit, and we'll have a better idea about
what we might do to fix it.
Link: http://lkml.kernel.org/r/1480369871-5271-66-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
444306129a
rxrpc: abstract away knowledge of IDR internals
...
Add idr_get_cursor() / idr_set_cursor() APIs, and remove the reference
to IDR_SIZE.
Link: http://lkml.kernel.org/r/1480369871-5271-65-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Reviewed-by: David Howells <dhowells@redhat.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
37f4915fef
tpm: use idr_find(), not idr_find_slowpath()
...
idr_find_slowpath() is not intended to be part of the public API, it's
an implementation detail. There's no reason to skip straight to the
slowpath here.
Link: http://lkml.kernel.org/r/1480369871-5271-64-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Peter Huewe <peterhuewe@gmx.de >
Cc: Marcel Selhorst <tpmdd@selhorst.net >
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com >
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
99c494077e
idr: add ida_is_empty
...
Two of the USB Gadgets were poking around in the internals of struct ida
in order to determine if it is empty. Add the appropriate abstraction.
Link: http://lkml.kernel.org/r/1480369871-5271-63-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Acked-by: Konstantin Khlebnikov <koct9i@gmail.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Felipe Balbi <balbi@kernel.org >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Michal Nazarewicz <mina86@mina86.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
3e3cdc68be
radix tree test suite: check multiorder iteration
...
The random iteration test only inserts order-0 entries currently.
Update it to insert entries of order between 7 and 0. Also make the
maximum index configurable, make some variables static, make the test
duration variable, remove some useless spinning, and add a fifth thread
which calls tag_tagged_items().
Link: http://lkml.kernel.org/r/1480369871-5271-62-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
a90eb3a2a4
radix-tree: fix replacement for multiorder entries
...
When replacing an entry with NULL, we need to delete any sibling
entries. Also account deleting exceptional entries properly. Also fix
a bug with radix_tree_iter_replace() where we would fail to remove
entirely freed nodes. Also fix accounting bug when switching between
normal and exceptional entries with replace_slot. Also add testcases
for all these bugs.
Link: http://lkml.kernel.org/r/1480369871-5271-61-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
2791653a68
radix-tree: add radix_tree_split_preload()
...
Calculate how many nodes we need to allocate to split an old_order entry
into multiple entries, each of size new_order. The test suite checks
that we allocated exactly the right number of nodes; neither too many
(checked by rtp->nr == 0), nor too few (checked by comparing
nr_allocated before and after the call to radix_tree_split()).
Link: http://lkml.kernel.org/r/1480369871-5271-60-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
e157b55594
radix-tree: add radix_tree_split
...
This new function splits a larger multiorder entry into smaller entries
(potentially multi-order entries). These entries are initialised to
RADIX_TREE_RETRY to ensure that RCU walkers who see this state aren't
confused. The caller should then call radix_tree_for_each_slot() and
radix_tree_replace_slot() in order to turn these retry entries into the
intended new entries. Tags are replicated from the original multiorder
entry into each new entry.
Link: http://lkml.kernel.org/r/1480369871-5271-59-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
175542f575
radix-tree: add radix_tree_join
...
This new function allows for the replacement of many smaller entries in
the radix tree with one larger multiorder entry. From the point of view
of an RCU walker, they may see a mixture of the smaller entries and the
large entry during the same walk, but they will never see NULL for an
index which was populated before the join.
Link: http://lkml.kernel.org/r/1480369871-5271-58-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
268f42de71
radix-tree: delete radix_tree_range_tag_if_tagged()
...
This is an exceptionally complicated function with just one caller
(tag_pages_for_writeback). We devote a large portion of the runtime of
the test suite to testing this one function which has one caller. By
introducing the new function radix_tree_iter_tag_set(), we can eliminate
all of the complexity while keeping the performance. The caller can now
use a fairly standard radix_tree_for_each() loop, and it doesn't need to
worry about tricksy things like 'start' wrapping.
The test suite continues to spend a large amount of time investigating
this function, but now it's testing the underlying primitives such as
radix_tree_iter_resume() and the radix_tree_for_each_tagged() iterator
which are also used by other parts of the kernel.
Link: http://lkml.kernel.org/r/1480369871-5271-57-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@infradead.org >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
478922e2b0
radix-tree: delete radix_tree_locate_item()
...
This rather complicated function can be better implemented as an
iterator. It has only one caller, so move the functionality to the only
place that needs it. Update the test suite to follow the same pattern.
Link: http://lkml.kernel.org/r/1480369871-5271-56-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Acked-by: Konstantin Khlebnikov <koct9i@gmail.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
148deab223
radix-tree: improve multiorder iterators
...
This fixes several interlinked problems with the iterators in the
presence of multiorder entries.
1. radix_tree_iter_next() would only advance by one slot, which would
result in the iterators returning the same entry more than once if
there were sibling entries.
2. radix_tree_next_slot() could return an internal pointer instead of
a user pointer if a tagged multiorder entry was immediately followed by
an entry of lower order.
3. radix_tree_next_slot() expanded to a lot more code than it used to
when multiorder support was compiled in. And I wasn't comfortable with
entry_to_node() being in a header file.
Fixing radix_tree_iter_next() for the presence of sibling entries
necessarily involves examining the contents of the radix tree, so we now
need to pass 'slot' to radix_tree_iter_next(), and we need to change the
calling convention so it is called *before* dropping the lock which
protects the tree. Also rename it to radix_tree_iter_resume(), as some
people thought it was necessary to call radix_tree_iter_next() each time
around the loop.
radix_tree_next_slot() becomes closer to how it looked before multiorder
support was introduced. It only checks to see if the next entry in the
chunk is a sibling entry or a pointer to a node; this should be rare
enough that handling this case out of line is not a performance impact
(and such impact is amortised by the fact that the entry we just
processed was a multiorder entry). Also, radix_tree_next_slot() used to
force a new chunk lookup for untagged entries, which is more expensive
than the out of line sibling entry skipping.
Link: http://lkml.kernel.org/r/1480369871-5271-55-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
b35df27a39
btrfs: fix race in btrfs_free_dummy_fs_info()
...
We drop the lock which protects the radix tree, so we must call
radix_tree_iter_next() in order to avoid a modification to the tree
invalidating the iterator state.
Link: http://lkml.kernel.org/r/1480369871-5271-54-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
218ed7503a
radix-tree: improve dump output
...
Print the indices of the entries as unsigned (instead of signed)
integers and print the parent node of each entry to help navigate around
larger trees where the layout is not quite so obvious. Print the
indices covered by a node. Rearrange the order of fields printed so the
indices and parents line up for each type of entry.
Link: http://lkml.kernel.org/r/1480369871-5271-53-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@infradead.org >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
bc412fca6e
radix-tree: make radix_tree_find_next_bit more useful
...
Since this function is specialised to the radix tree, pass in the node
and tag to calculate the address of the bitmap in
radix_tree_find_next_bit() instead of the caller. Likewise, there is no
need to pass in the size of the bitmap.
Link: http://lkml.kernel.org/r/1480369871-5271-52-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@infradead.org >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
9498d2bb34
radix-tree: create node_tag_set()
...
Similar to node_tag_clear(), factor node_tag_set() out of
radix_tree_range_tag_if_tagged().
Link: http://lkml.kernel.org/r/1480369871-5271-51-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
91d9c05ac6
radix-tree: move rcu_head into a union with private_list
...
I want to be able to reference node->parent after freeing node.
Currently node->parent is in a union with rcu_head, so it is overwritten
when the node is put on the RCU list. We know that private_list is not
referenced after the node is freed, so it is safe for these two members
to share space.
Link: http://lkml.kernel.org/r/1480369871-5271-50-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@infradead.org >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
91b9677c4c
radix-tree: fix typo
...
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
0629573e6b
radix tree test suite: use common find-bit code
...
Remove the old find_next_bit code in favour of linking in the find_bit
code from tools/lib.
Link: http://lkml.kernel.org/r/1480369871-5271-48-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
b328daf3b7
tools: add more bitmap functions
...
I need the following functions for the radix tree:
bitmap_fill
bitmap_empty
bitmap_full
Copy the implementations from include/linux/bitmap.h
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
101d9607ff
radix tree test suite: record order in each item
...
This probably doubles the size of each item allocated by the test suite
but it lets us check a few more things, and may be needed for upcoming
API changes that require the caller pass in the order of the entry.
Link: http://lkml.kernel.org/r/1480369871-5271-46-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
3ad75f8a1d
radix tree test suite: handle exceptional entries
...
item_kill_tree() assumes that everything in the tree is a pointer to a
struct item, which is annoying when testing the behaviour of exceptional
entries. Fix it to delete exceptional entries on the assumption they
don't need to be freed.
Link: http://lkml.kernel.org/r/1480369871-5271-45-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:10 -08:00
Matthew Wilcox
af1c5cca90
radix tree test suite: use rcu_barrier
...
Calling rcu_barrier() allows all of the rcu-freed memory to be actually
returned to the pool, and allows nr_allocated to return to 0. As well
as allowing diffs between runs to be more useful, it also lets us
pinpoint leaks more effectively.
Link: http://lkml.kernel.org/r/1480369871-5271-44-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:09 -08:00
Konstantin Khlebnikov
cfa40bcfd6
radix tree test suite: benchmark for iterator
...
This adds simple benchmark for iterator similar to one I've used for
commit 78c1d78488 ("radix-tree: introduce bit-optimized iterator")
Building with make BENCHMARK=1 set radix tree order to 6, this allows to
get performance comparable to in kernel performance.
Link: http://lkml.kernel.org/r/1480369871-5271-43-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com >
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:09 -08:00
Matthew Wilcox
ba20cd60c9
radix tree test suite: iteration test misuses RCU
...
Each thread needs to register itself with RCU, otherwise the reading
thread's read lock has no effect and the freeing thread will free the
memory in the tree without waiting for the read lock to be dropped.
Link: http://lkml.kernel.org/r/1480369871-5271-42-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:09 -08:00
Matthew Wilcox
061ef3936b
radix tree test suite: make runs more reproducible
...
Instead of reseeding the random number generator every time around the
loop in big_gang_check(), seed it at the beginning of execution. Use
rand_r() and an independent base seed for each thread in
iteration_test() so they don't stomp all over each others state. Since
this particular test depends on the kernel scheduler, the iteration test
can't be reproduced based purely on the random seed, but at least it
won't pollute the other tests.
Print the seed, and allow the seed to be specified so that a run which
hits a problem can be reproduced.
Link: http://lkml.kernel.org/r/1480369871-5271-41-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@infradead.org >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:09 -08:00
Matthew Wilcox
6df5ee7867
radix tree test suite: free preallocated nodes
...
It can be a source of mild concern when the test suite shows that we're
leaking nodes. While poring over the source code looking for leaks can
lead to some fascinating bugs being discovered, sometimes the leak is
simply that these nodes were preallocated and are sitting on the per-CPU
list. Free them by calling the CPU dead callback.
Link: http://lkml.kernel.org/r/1480369871-5271-40-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@infradead.org >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:09 -08:00
Matthew Wilcox
847d357635
radix tree test suite: track preempt_count
...
Rather than simply NOP out preempt_enable() and preempt_disable(), keep
track of preempt_count and display it regularly in case either the test
suite or the code under test is forgetting to balance the enables &
disables. Only found a test-case that was forgetting to re-enable
preemption, but it's a possibility worth checking.
Link: http://lkml.kernel.org/r/1480369871-5271-39-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@infradead.org >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:09 -08:00
Matthew Wilcox
31023cd664
radix tree test suite: allow GFP_ATOMIC allocations to fail
...
In order to test the preload code, it is necessary to fail GFP_ATOMIC
allocations, which requires defining GFP_KERNEL and GFP_ATOMIC properly.
Remove the obsolete __GFP_WAIT and copy the definitions of the __GFP
flags which are used from the kernel include files. We also need the
real definition of gfpflags_allow_blocking() to persuade the radix tree
to actually use its preallocated nodes.
Link: http://lkml.kernel.org/r/1480369871-5271-38-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:09 -08:00
Matthew Wilcox
ebb9a9aedb
tools: add WARN_ON_ONCE
...
Patch series "Radix tree patches for 4.10", v3.
Mostly these are improvements; the only bug fixes in here relate to
multiorder entries (which are unused in the 4.9 tree).
This patch (of 32):
The radix tree uses its own buggy WARN_ON_ONCE. Replace it with the
definition from asm-generic/bug.h
Link: http://lkml.kernel.org/r/1480369871-5271-37-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com >
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Konstantin Khlebnikov <koct9i@gmail.com >
Cc: Ross Zwisler <ross.zwisler@linux.intel.com >
Cc: Matthew Wilcox <mawilcox@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2016-12-14 16:04:09 -08:00