\subsection{The ION Memory Allocator}
\begin{frame}
  \frametitle{ION 1/2}
  \begin{itemize}
  \item ION was introduced with Ice Cream Sandwich (4.0) version of
    Android
  \item Its role is to allocate memory in the system, for most of the
    possible cases, and to allow different devices to share buffers,
    without any copy, possibly from an user space application
  \item It's for example useful if you want to retrieve an image from
    a camera, and push it to the JPEG hardware encoder from an
    user space application
  \item The usual Linux memory allocators can only allocate a buffer
    that is up to 512 pages wide, with a page usually being 4kiB.
  \item There was previously for Android (and Linux in general) some
    vendor specific mechanism to allocate larger physically contiguous
    memory areas (\code{nvmap} for nVidia, \code{CMEM} for TI, etc.)
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{ION 2/2}
  \begin{itemize}
  \item ION is here to unify the interface to allocate memory in the
    system, no matter on which SoC you're running on.
  \item It uses a system of heaps, with Linux publishing the heaps
    available on a given system.
  \item By default, you have three different heaps:
    \begin{description}
    \item[system] Memory virtually contiguous memory, backed by
      \code{vmalloc}
    \item[system contiguous] Physically contiguous memory, backed by
      \code{kmalloc}
    \item[carveout] Large physically contiguous memory, preallocated
      at boot
    \end{description}
  \item It also has a user space interface so that processes can
    allocate memory to work on.
  \item \url{https://lwn.net/Articles/480055/}
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Comparison with mainline equivalents}
  \begin{itemize}
    \item ION has entered staging since 3.14. And:
    \begin{itemize}
    \item The contiguous allocation of the buffers is done through
      \code{CMA}
    \item The buffer sharing between devices is made through
      \code{dma-buf}
    \item Its user space API also allows to allocate and share buffers
      from the user space, which was not possible otherwise.
    \item This API is also used to set the allocation constraints
      devices might have (for example, when one particular device can
      only access a subset of the memory, or when it needs to setup an
      IOMMU)
    \end{itemize}
  \end{itemize}
\end{frame}
