FreeBSD src
Go to file
Brian Behlendorf c3eabc75b1 Refactor generic memory allocation interfaces
This patch achieves the following goals:

1. It replaces the preprocessor kmem flag to gfp flag mapping with
   proper translation logic. This eliminates the potential for
   surprises that were previously possible where kmem flags were
   mapped to gfp flags.

2. It maps vmem_alloc() allocations to kmem_alloc() for allocations
   sized less than or equal to the newly-added spl_kmem_alloc_max
   parameter.  This ensures that small allocations will not contend
   on a single global lock, large allocations can still be handled,
   and potentially limited virtual address space will not be squandered.
   This behavior is entirely different than under Illumos due to
   different memory management strategies employed by the respective
   kernels.  However, this functionally provides the semantics required.

3. The --disable-debug-kmem, --enable-debug-kmem (default), and
   --enable-debug-kmem-tracking allocators have been unified in to
   a single spl_kmem_alloc_impl() allocation function.  This was
   done to simplify the code and make it more maintainable.

4. Improve portability by exposing an implementation of the memory
   allocations functions that can be safely used in the same way
   they are used on Illumos.   Specifically, callers may safely
   use KM_SLEEP in contexts which perform filesystem IO.  This
   allows us to eliminate an entire class of Linux specific changes
   which were previously required to avoid deadlocking the system.

This change will be largely transparent to existing callers but there
are a few caveats:

1. Because the headers were refactored and extraneous includes removed
   callers may find they need to explicitly add additional #includes.
   In particular, kmem_cache.h must now be explicitly includes to
   access the SPL's kmem cache implementation.  This behavior is
   different from Illumos but it was done to avoid always masking
   the Linux slab functions when kmem.h is included.

2. Callers, like Lustre, which made assumptions about the definitions
   of KM_SLEEP, KM_NOSLEEP, and KM_PUSHPAGE will need to be updated.
   Other callers such as ZFS which did not will not require changes.

3. KM_PUSHPAGE is no longer overloaded to imply GFP_NOIO.  It retains
   its original meaning of allowing allocations to access reserved
   memory.  KM_PUSHPAGE callers can be converted back to KM_SLEEP.

4. The KM_NODEBUG flags has been retired and the default warning
   threshold increased to 32k.

5. The kmem_virt() functions has been removed.  For callers which
   need to distinguish between a physical and virtual address use
   is_vmalloc_addr().

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2015-01-16 13:55:09 -08:00
cmd Retire legacy debugging infrastructure 2014-11-19 10:35:07 -08:00
config Retire legacy debugging infrastructure 2014-11-19 10:35:07 -08:00
include Refactor generic memory allocation interfaces 2015-01-16 13:55:09 -08:00
lib Remove autotools products 2012-08-27 11:46:23 -07:00
man Refactor generic memory allocation interfaces 2015-01-16 13:55:09 -08:00
module Refactor generic memory allocation interfaces 2015-01-16 13:55:09 -08:00
rpm Tag spl-0.6.3 2014-06-12 11:32:38 -07:00
scripts Retire legacy debugging infrastructure 2014-11-19 10:35:07 -08:00
.gitignore Ignore *.{deb,rpm,tar.gz} files in the top directory. 2013-04-24 16:18:14 -07:00
AUTHORS Refresh AUTHORS 2012-12-19 09:40:18 -08:00
autogen.sh build: do not call boilerplate ourself 2013-04-02 11:08:46 -07:00
configure.ac Document SPL module parameters. 2013-11-21 12:32:41 -08:00
copy-builtin Copy spl.release.in to kernel dir 2013-06-21 15:40:04 -07:00
COPYING Public Release Prep 2010-05-17 15:18:00 -07:00
DISCLAIMER Public Release Prep 2010-05-17 15:18:00 -07:00
Makefile.am Kernel header installation should respect --prefix 2014-10-28 09:31:48 -07:00
META Make license compatibility checks consistent 2014-10-17 15:07:28 -07:00
README.markdown Document how to run SPLAT 2013-10-09 13:52:59 -07:00
spl.release.in Move spl.release generation to configure step 2012-07-12 12:13:47 -07:00

The Solaris Porting Layer (SPL) is a Linux kernel module which provides many of the Solaris kernel APIs. This shim layer makes it possible to run Solaris kernel code in the Linux kernel with relatively minimal modification. This can be particularly useful when you want to track upstream Solaris development closely and do not want the overhead of maintaining a large patch which converts Solaris primitives to Linux primitives.

To build packages for your distribution:

$ ./configure
$ make pkg

If you are building directly from the git tree and not an officially released tarball you will need to generate the configure script. This can be done by executing the autogen.sh script after installing the GNU autotools for your distribution.

To copy the kernel code inside your kernel source tree for builtin compilation:

$ ./configure --enable-linux-builtin --with-linux=/usr/src/linux-...
$ ./copy-builtin /usr/src/linux-...

The SPL comes with an automated test suite called SPLAT. The test suite is implemented in two parts. There is a kernel module which contains the tests and a user space utility which controls which tests are run. To run the full test suite:

$ sudo insmod ./module/splat/splat.ko
$ sudo ./cmd/splat --all

Full documentation for building, configuring, testing, and using the SPL can be found at: http://zfsonlinux.org