Move ARC data buffers out of vmalloc #2129

Introduce ABD: linear/scatter dual typed buffer for ARC

zfsolinux currently uses vmalloc backed slab for ARC buffers. There are some
major problems with this approach. One is that 32-bit system have only a
handful of vmalloc space. Another is that the fragmentation in slab will easily
trigger OOM in busy system.

With ABD, we use scatterlist to allocate data buffers. In this approach we can
allocate in HIGHMEM, which alleviates vmalloc space pressure on 32-bit. Also,
we don't have to rely on slab, so there's no fragmentation issue.

But for metadata buffers, we still uses linear buffer from slab. The reason for
this is that there are a lot of *_phys pointers directly point to metadata
buffers. So it's kind of impractical to change all those code. And metadata
should only be a small percentage so we probably don't have to worry about
the 32-bit and fragmentation issue, right?

This patchset is divided into the following part:
1. Add compatibility layer for {kmap,kunmap}_atomic
2. Introduce ABD, but with scatter type disabled
3. Modify checksum implementation for ABD
4. Modify every file which touches abd_t field
5. Enable scatter type ABD

Edit:
I forgot to mention...
There are some parts that hasn't been able to handle scatter buffer,
compression and raidz gaussian elimination to name a few.
Enable them will cost you extra copy than without this patch set.
Another thing is the xuio thing, which I totally skip.

Todo:
1. Clean up the implementation and documentation
2. Compression and raidz gaussian elimination takes scatter buffer
3. Probably change vdev_cache and vdev_queue to scatter buffer
4. vdev_file should be able to submit a iovec.

---------------------------------------------------------------------------------------

Rebased and add userspace scatter ABD

---------------------------------------------------------------------------------------

Remove container_of kernel code

---------------------------------------------------------------------------------------

Rebase to master and add two patch for missing things

There're still a lot of checksum error when running ztest, and all of them are data blocks.
I still haven't figure out why.

Apr 24 2014

---------------------------------------------------------------------------------------

So the original sha256 implementation cannot be used as-is for scatter abd.
This should work now.

Apr 25 2014

---------------------------------------------------------------------------------------

Hi all,

I just found out there's a bug causing lockup when rebuilding pool with raidz2 or above.
I've already fixed it in my working tree, but I still need to test it together with other piles of changes.
In the meantime, if you need to rebuild such pool, please use unpatched zfs to do so.

Thanks

Jun 18 2014

---------------------------------------------------------------------------------------

@sempervictus
When the bug is triggered, there will be a zfs thread looping infinitely.
So you should see that thread consuming 100% CPU in system monitor.
Also, if the kernel is built with !CONFIG_PREEMPT, there should be "BUG: soft lockup" in dmesg.

---------------------------------------------------------------------------------------

Hi all

I updated the patch series.
There are many changes, but most of them are cosmetic.

The notable ones are:
1. Rebase to 0.6.3
2. Bug fixes are squashed back.
3. Fix make checkstyle
4. Rename some APIs. This is to differentiate "buf" and "linear", where the first denotes normal buffer and the latter denotes linear type abd.
5. Fix the above mentioned raidz2 rebuild bug.

---------------------------------------------------------------------------------------

@DeHackEd
I've updated these patches.
How will buildbot run it?

Edit: Never mind the question.

Oct 3 2014

---------------------------------------------------------------------------------------