linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, keescook@chromium.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] mm/shuffle: Fix shuffle enable
Date: Tue, 05 Feb 2019 23:12:10 -0800	[thread overview]
Message-ID: <154943713038.3858443.4125180191382062871.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <154943712485.3858443.4491117952728936852.stgit@dwillia2-desk3.amr.corp.intel.com>

The removal of shuffle_store() in v10 of the patch series was prompted
by the review feedback to convert page_alloc_shuffle() to __memint. I
obviously booted a stale kernel build in my tests because
shuffle_store() is indeed required:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
 #PF error: [INSTR]
 PGD 0 P4D 0
 Oops: 0010 [#1] SMP PTI
 CPU: 0 PID: 0 Comm: swapper Not tainted 5.0.0-rc1+ #2867
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20180531_142017-buildhw-08.phx2.fedoraproject.org-1.fc28 04/01/2014
 RIP: 0010:          (null)
 Code: Bad RIP value.
 RSP: 0000:ffffffff82603e78 EFLAGS: 00010046
 RAX: 0000000000000000 RBX: 0000000000000000 RCX: cccccccccccccccd
 RDX: ffffffff8261d7c0 RSI: ffffffff8244c010 RDI: ffff88843ffe1aaa
 RBP: ffff88843ffe1aac R08: ffffffff83486978 R09: 0000000000000000
 R10: ffffffff82603e80 R11: 0000000000000048 R12: ffff88843ffe1a97
 R13: ffff88843ffe1aaa R14: ffffffff8244c010 R15: 000000000000016d
 FS:  0000000000000000(0000) GS:ffff88811be00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: ffffffffffffffd6 CR3: 0000000002614000 CR4: 00000000000606b0
 Call Trace:
  ? parse_args+0x170/0x360
  ? set_init_arg+0x55/0x55
  ? start_kernel+0x1d8/0x4c4
  ? set_init_arg+0x55/0x55
  ? secondary_startup_64+0xa4/0xb0

Reintroduce it and mark it __meminit. Given the sysfs attribute is not
writable it will never be called after init.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 mm/shuffle.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/mm/shuffle.c b/mm/shuffle.c
index 19bbf3e37fb6..3ce12481b1dc 100644
--- a/mm/shuffle.c
+++ b/mm/shuffle.c
@@ -38,7 +38,21 @@ extern int shuffle_show(char *buffer, const struct kernel_param *kp)
 	return sprintf(buffer, "%c\n", test_bit(SHUFFLE_ENABLE, &shuffle_state)
 			? 'Y' : 'N');
 }
-module_param_call(shuffle, NULL, shuffle_show, &shuffle_param, 0400);
+
+static __meminit int shuffle_store(const char *val,
+		const struct kernel_param *kp)
+{
+	int rc = param_set_bool(val, kp);
+
+	if (rc < 0)
+		return rc;
+	if (shuffle_param)
+		page_alloc_shuffle(SHUFFLE_ENABLE);
+	else
+		page_alloc_shuffle(SHUFFLE_FORCE_DISABLE);
+	return 0;
+}
+module_param_call(shuffle, shuffle_store, shuffle_show, &shuffle_param, 0400);
 
 /*
  * For two pages to be swapped in the shuffle, they must be free (on a


  reply	other threads:[~2019-02-06  7:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06  7:12 [PATCH 0/2] mm/shuffle: Fix + default enable Dan Williams
2019-02-06  7:12 ` Dan Williams [this message]
2019-02-06  7:12 ` [PATCH 2/2] [-mm only] mm/shuffle: Default enable all shuffling Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=154943713038.3858443.4125180191382062871.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).