All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Nitin Gupta <ngupta@vflare.org>,
	Seth Jennings <sjenning@linux.vnet.ibm.com>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	Konrad Rzeszutek Wilk <konrad@darnok.org>,
	Minchan Kim <minchan@kernel.org>
Subject: [PATCH 2/7] zsmalloc: prevent mappping in interrupt context
Date: Wed,  8 Aug 2012 15:12:15 +0900	[thread overview]
Message-ID: <1344406340-14128-3-git-send-email-minchan@kernel.org> (raw)
In-Reply-To: <1344406340-14128-1-git-send-email-minchan@kernel.org>

From: Seth Jennings <sjenning@linux.vnet.ibm.com>

Because we use per-cpu mapping areas shared among the
pools/users, we can't allow mapping in interrupt context
because it can corrupt another users mappings.

Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
 drivers/staging/zsmalloc/zsmalloc-main.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index 3c83c65..b86133f 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -75,6 +75,7 @@
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
 #include <linux/vmalloc.h>
+#include <linux/hardirq.h>
 
 #include "zsmalloc.h"
 #include "zsmalloc_int.h"
@@ -761,6 +762,13 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
 
 	BUG_ON(!handle);
 
+	/*
+	 * Because we use per-cpu mapping areas shared among the
+	 * pools/users, we can't allow mapping in interrupt context
+	 * because it can corrupt another users mappings.
+	 */
+	BUG_ON(in_interrupt());
+
 	obj_handle_to_location(handle, &page, &obj_idx);
 	get_zspage_mapping(get_first_page(page), &class_idx, &fg);
 	class = &pool->size_class[class_idx];
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Nitin Gupta <ngupta@vflare.org>,
	Seth Jennings <sjenning@linux.vnet.ibm.com>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	Konrad Rzeszutek Wilk <konrad@darnok.org>,
	Minchan Kim <minchan@kernel.org>
Subject: [PATCH 2/7] zsmalloc: prevent mappping in interrupt context
Date: Wed,  8 Aug 2012 15:12:15 +0900	[thread overview]
Message-ID: <1344406340-14128-3-git-send-email-minchan@kernel.org> (raw)
In-Reply-To: <1344406340-14128-1-git-send-email-minchan@kernel.org>

From: Seth Jennings <sjenning@linux.vnet.ibm.com>

Because we use per-cpu mapping areas shared among the
pools/users, we can't allow mapping in interrupt context
because it can corrupt another users mappings.

Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
 drivers/staging/zsmalloc/zsmalloc-main.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index 3c83c65..b86133f 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -75,6 +75,7 @@
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
 #include <linux/vmalloc.h>
+#include <linux/hardirq.h>
 
 #include "zsmalloc.h"
 #include "zsmalloc_int.h"
@@ -761,6 +762,13 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
 
 	BUG_ON(!handle);
 
+	/*
+	 * Because we use per-cpu mapping areas shared among the
+	 * pools/users, we can't allow mapping in interrupt context
+	 * because it can corrupt another users mappings.
+	 */
+	BUG_ON(in_interrupt());
+
 	obj_handle_to_location(handle, &page, &obj_idx);
 	get_zspage_mapping(get_first_page(page), &class_idx, &fg);
 	class = &pool->size_class[class_idx];
-- 
1.7.9.5


  parent reply	other threads:[~2012-08-08  6:10 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08  6:12 [PATCH 0/7] zram/zsmalloc promotion Minchan Kim
2012-08-08  6:12 ` Minchan Kim
2012-08-08  6:12 ` [PATCH 1/7] zsmalloc: s/firstpage/page in new copy map funcs Minchan Kim
2012-08-08  6:12   ` Minchan Kim
2012-08-08  6:12 ` Minchan Kim [this message]
2012-08-08  6:12   ` [PATCH 2/7] zsmalloc: prevent mappping in interrupt context Minchan Kim
2012-08-08  6:12 ` [PATCH 3/7] zsmalloc: add page table mapping method Minchan Kim
2012-08-08  6:12   ` Minchan Kim
2012-08-08  6:12 ` [PATCH 4/7] zsmalloc: collapse internal .h into .c Minchan Kim
2012-08-08  6:12   ` Minchan Kim
2012-08-08  6:12 ` [PATCH 5/7] zsmalloc: promote to mm/ Minchan Kim
2012-08-08  6:12   ` Minchan Kim
2012-08-08  6:12 ` [PATCH 6/7] zram: promote zram from staging Minchan Kim
2012-08-08  6:12   ` Minchan Kim
2012-08-08  6:12 ` [PATCH 7/7] zram: select ZSMALLOC when ZRAM is configured Minchan Kim
2012-08-08  6:12   ` Minchan Kim
2012-08-08 17:35 ` [PATCH 0/7] zram/zsmalloc promotion Nitin Gupta
2012-08-08 17:35   ` Nitin Gupta
2012-08-10  1:15   ` Konrad Rzeszutek Wilk
2012-08-10  1:15     ` Konrad Rzeszutek Wilk
2012-08-14  2:35 ` Greg Kroah-Hartman
2012-08-14  2:35   ` Greg Kroah-Hartman
2012-08-14  5:36   ` Nitin Gupta
2012-08-14  5:36     ` Nitin Gupta
2012-08-14  6:20     ` Minchan Kim
2012-08-14  6:20       ` Minchan Kim
2012-08-14 17:39     ` Seth Jennings
2012-08-14 17:39       ` Seth Jennings
2012-08-15  9:42       ` Konrad Rzeszutek Wilk
2012-08-15  9:42         ` Konrad Rzeszutek Wilk
2012-08-15 15:23       ` Dan Magenheimer
2012-08-15 15:23         ` Dan Magenheimer
2012-08-14  6:22   ` Minchan Kim
2012-08-14  6:22     ` Minchan Kim
2012-08-14 13:21     ` Konrad Rzeszutek Wilk
2012-08-14 13:21       ` Konrad Rzeszutek Wilk
2012-08-17  5:47     ` Nitin Gupta
2012-08-17  5:47       ` Nitin Gupta
2012-08-21  0:56       ` Minchan Kim
2012-08-21  0:56         ` Minchan Kim

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=1344406340-14128-3-git-send-email-minchan@kernel.org \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dan.magenheimer@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad@darnok.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ngupta@vflare.org \
    --cc=sjenning@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.