summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Yao <ryao@gentoo.org>2012-06-17 17:03:12 +0000
committerRichard Yao <ryao@gentoo.org>2012-06-17 17:03:12 +0000
commite7245bcdd9ba00629029d3e01be84ba24d3f1cf9 (patch)
tree36050c82aff8042a2d81a9a0142b6d39ade54d95 /sys-kernel
parentAdd ~alpha/~ia64/~s390/~sh/~sparc wrt #410239 (diff)
downloadgentoo-2-e7245bcdd9ba00629029d3e01be84ba24d3f1cf9.tar.gz
gentoo-2-e7245bcdd9ba00629029d3e01be84ba24d3f1cf9.tar.bz2
gentoo-2-e7245bcdd9ba00629029d3e01be84ba24d3f1cf9.zip
Add patch to take advantage of kernel change from bug #416685
(Portage version: 2.1.10.49/cvs/Linux x86_64)
Diffstat (limited to 'sys-kernel')
-rw-r--r--sys-kernel/spl/ChangeLog7
-rw-r--r--sys-kernel/spl/files/spl-0.6.0_rc9-detect-kernel-honors-gfp-flags.patch91
-rw-r--r--sys-kernel/spl/spl-0.6.0_rc9.ebuild10
-rw-r--r--sys-kernel/spl/spl-9999.ebuild10
4 files changed, 113 insertions, 5 deletions
diff --git a/sys-kernel/spl/ChangeLog b/sys-kernel/spl/ChangeLog
index 204fc3bec420..114891dab75a 100644
--- a/sys-kernel/spl/ChangeLog
+++ b/sys-kernel/spl/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for sys-kernel/spl
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/ChangeLog,v 1.17 2012/06/17 16:40:27 ryao Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/ChangeLog,v 1.18 2012/06/17 17:03:12 ryao Exp $
+
+ 17 Jun 2012; Richard Yao <ryao@gentoo.org>
+ +files/spl-0.6.0_rc9-detect-kernel-honors-gfp-flags.patch,
+ spl-0.6.0_rc9.ebuild, spl-9999.ebuild:
+ Add patch to take advantage of kernel change from bug #416685
17 Jun 2012; Richard Yao <ryao@gentoo.org> spl-0.6.0_rc9.ebuild,
spl-9999.ebuild:
diff --git a/sys-kernel/spl/files/spl-0.6.0_rc9-detect-kernel-honors-gfp-flags.patch b/sys-kernel/spl/files/spl-0.6.0_rc9-detect-kernel-honors-gfp-flags.patch
new file mode 100644
index 000000000000..ac10de7a8f17
--- /dev/null
+++ b/sys-kernel/spl/files/spl-0.6.0_rc9-detect-kernel-honors-gfp-flags.patch
@@ -0,0 +1,91 @@
+From 35f75553b720037eb7ef6ac9954c14f7d9c1b4e5 Mon Sep 17 00:00:00 2001
+From: Richard Yao <ryao@cs.stonybrook.edu>
+Date: Wed, 6 Jun 2012 22:38:12 -0400
+Subject: [PATCH] Detect kernels that honor gfp flags passed to vmalloc()
+
+zfsonlinux/spl@2092cf68d89a51eb0d6193aeadabb579dfc4b4a0 used PF_MEMALLOC
+to workaround a bug in the Linux kernel where allocations did not honor
+the gfp flags passed to vmalloc(). Unfortunately, PF_MEMALLOC has the
+side effect of permitting allocations to allocate pages outside of
+ZONE_NORMAL. This has been observed to result in the depletion of
+ZONE_DMA32 on Gentoo Linux. A kernel patch is available in the Gentoo
+bug tracker for this issue:
+
+https://bugs.gentoo.org/show_bug.cgi?id=416685
+
+This negates any benefit PF_MEMALLOC provides, so we introduce an
+autotools check to disable the use of PF_MEMALLOC on systems with
+patched kernels.
+
+Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
+---
+ config/spl-build.m4 | 26 ++++++++++++++++++++++++++
+ module/spl/spl-kmem.c | 4 ++++
+ 2 files changed, 30 insertions(+)
+
+diff --git a/config/spl-build.m4 b/config/spl-build.m4
+index 6605b82..29c7ae4 100644
+--- a/config/spl-build.m4
++++ b/config/spl-build.m4
+@@ -87,6 +87,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
+ SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
+ SPL_AC_SHRINK_CONTROL_STRUCT
+ SPL_AC_RWSEM_SPINLOCK_IS_RAW
++ SPL_AC_PMD_ALLOC_WITH_MASK
+ ])
+
+ AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
+@@ -2056,3 +2057,28 @@ AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
+ ])
+ EXTRA_KCFLAGS="$tmp_flags"
+ ])
++
++dnl #
++dnl # 2.6.20 API change,
++dnl # INIT_WORK use 2 args and not store data inside
++dnl #
++AC_DEFUN([SPL_AC_PMD_ALLOC_WITH_MASK],
++ [AC_MSG_CHECKING([whether pmd_alloc_with_mask exists])
++ SPL_LINUX_TRY_COMPILE([
++ #define CONFIG_MMU
++ #undef RCH_HAS_4LEVEL_HACK
++ #include <linux/mm.h>
++ ],[
++ struct mm_struct init_mm;
++ pud_t pud;
++ unsigned long addr;
++ gfp_t gfp_mask;
++ pmd_alloc_with_mask(&init_mm, &pud, addr, gfp_mask);
++ ],[
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_PMD_ALLOC_WITH_MASK, 1,
++ [pmd_alloc_with_mask exists])
++ ],[
++ AC_MSG_RESULT(no)
++ ])
++])
+diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
+index e1d74d3..c640779 100644
+--- a/module/spl/spl-kmem.c
++++ b/module/spl/spl-kmem.c
+@@ -843,6 +843,9 @@ static int spl_cache_flush(spl_kmem_cache_t *skc,
+ if (skc->skc_flags & KMC_KMEM) {
+ ptr = (void *)__get_free_pages(flags, get_order(size));
+ } else {
++#ifdef HAVE_PMD_ALLOC_WITH_MASK
++ ptr = __vmalloc(size, flags|__GFP_HIGHMEM, PAGE_KERNEL);
++#else
+ /*
+ * As part of vmalloc() an __pte_alloc_kernel() allocation
+ * may occur. This internal allocation does not honor the
+@@ -866,6 +869,7 @@ static int spl_cache_flush(spl_kmem_cache_t *skc,
+ } else {
+ ptr = __vmalloc(size, flags|__GFP_HIGHMEM, PAGE_KERNEL);
+ }
++#endif
+ }
+
+ /* Resulting allocated memory will be page aligned */
+--
+1.7.10
+
diff --git a/sys-kernel/spl/spl-0.6.0_rc9.ebuild b/sys-kernel/spl/spl-0.6.0_rc9.ebuild
index 835ac02feb35..1aaf31c2b1bf 100644
--- a/sys-kernel/spl/spl-0.6.0_rc9.ebuild
+++ b/sys-kernel/spl/spl-0.6.0_rc9.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-0.6.0_rc9.ebuild,v 1.2 2012/06/17 16:40:27 ryao Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-0.6.0_rc9.ebuild,v 1.3 2012/06/17 17:03:12 ryao Exp $
EAPI="4"
AUTOTOOLS_AUTORECONF="1"
@@ -11,7 +11,7 @@ if [[ ${PV} == "9999" ]] ; then
inherit git-2
EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
else
- inherit versionator
+ inherit eutils versionator
MY_PV=$(replace_version_separator 3 '-')
SRC_URI="https://github.com/downloads/zfsonlinux/${PN}/${PN}-${MY_PV}.tar.gz"
S="${WORKDIR}/${PN}-${MY_PV}"
@@ -48,6 +48,12 @@ pkg_setup() {
src_prepare() {
# Workaround for hard coded path
sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ epatch "${FILESDIR}/${P}-detect-kernel-honors-gfp-flags.patch"
+ fi
+
autotools-utils_src_prepare
}
diff --git a/sys-kernel/spl/spl-9999.ebuild b/sys-kernel/spl/spl-9999.ebuild
index 334187b6c7f1..3154ff0c2703 100644
--- a/sys-kernel/spl/spl-9999.ebuild
+++ b/sys-kernel/spl/spl-9999.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-9999.ebuild,v 1.16 2012/06/17 16:40:27 ryao Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-kernel/spl/spl-9999.ebuild,v 1.17 2012/06/17 17:03:12 ryao Exp $
EAPI="4"
AUTOTOOLS_AUTORECONF="1"
@@ -11,7 +11,7 @@ if [[ ${PV} == "9999" ]] ; then
inherit git-2
EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
else
- inherit versionator
+ inherit eutils versionator
MY_PV=$(replace_version_separator 3 '-')
SRC_URI="https://github.com/downloads/zfsonlinux/${PN}/${PN}-${MY_PV}.tar.gz"
S="${WORKDIR}/${PN}-${MY_PV}"
@@ -48,6 +48,12 @@ pkg_setup() {
src_prepare() {
# Workaround for hard coded path
sed -i "s|/sbin/lsmod|/bin/lsmod|" scripts/check.sh || die
+
+ if [ ${PV} != "9999" ]
+ then
+ epatch "${FILESDIR}/${P}-detect-kernel-honors-gfp-flags.patch"
+ fi
+
autotools-utils_src_prepare
}