From: "KAMEZAWA Hiroyuki" <kamezawa.hiroyu@jp.fujitsu.com>
To: nishimura@mxp.nes.nec.co.jp
Cc: Hugh Dickins <hugh@veritas.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm <linux-mm@kvack.org>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Pavel Emelianov <xemul@openvz.org>, LiZefan <lizf@cn.fujitsu.com>
Subject: [PATCH mmotm] memcg: avoid using buggy kmap at swap_cgroup
Date: Wed, 19 Nov 2008 01:12:10 +0900 (JST) [thread overview]
Message-ID: <6023.10.75.179.61.1227024730.squirrel@webmail-b.css.fujitsu.com> (raw)
In-Reply-To: <20081119001756.0a31b11e.d-nishimura@mtf.biglobe.ne.jp>
[-- Attachment #1: Type: text/plain, Size: 912 bytes --]
Daisuke Nishimura said:
> On Tue, 18 Nov 2008 12:48:52 +0000 (GMT)
> Hugh Dickins <hugh@veritas.com> wrote:
>> That's a lot of files which you may not wish to update to get working
>> right now: I think page_cgroup.c can _probably_ reuse KM_PTE1 as a
>> temporary measure, but please verify that's safe first.
>>
> Thank you for your comment.
>
> Hmm, shmem_map_and_free_swp might unmap dir anyway and caller
> (shmem_trancate_range) handles the case, but I do agree it's
> not good manner to unmap other people's kmaps.
>
Hmm...Sorry for my original implementation.
Okay, how about this direction ?
1. at first, remove kmap_atomic from page_cgroup.c and use GFP_KERNEL
to allocate buffer.
2. later, add kmap_atomic + HighMem buffer support in explicit style.
maybe KM_BOUNCE_READ...can be used.....
patch for BUGFIX is attached.
(Sorry, I have to use Web-Mail and can't make it inlined)
Sorry,
-Kame
[-- Attachment #2: swapcg-kmap-fix.patch --]
[-- Type: application/octet-stream, Size: 1418 bytes --]
swap_cgroup's kmap logic conflicts shmem's kmap logic.
avoid to use HIGHMEM for now and revisit this later.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
mm/page_cgroup.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
Index: temp/mm/page_cgroup.c
===================================================================
--- temp.orig/mm/page_cgroup.c
+++ temp/mm/page_cgroup.c
@@ -306,7 +306,7 @@ static int swap_cgroup_prepare(int type)
ctrl = &swap_cgroup_ctrl[type];
for (idx = 0; idx < ctrl->length; idx++) {
- page = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
+ page = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (!page)
goto not_enough_page;
ctrl->map[idx] = page;
@@ -347,11 +347,10 @@ struct mem_cgroup *swap_cgroup_record(sw
mappage = ctrl->map[idx];
spin_lock_irqsave(&ctrl->lock, flags);
- sc = kmap_atomic(mappage, KM_USER0);
+ sc = page_address(mappage);
sc += pos;
old = sc->val;
sc->val = mem;
- kunmap_atomic((void *)sc, KM_USER0);
spin_unlock_irqrestore(&ctrl->lock, flags);
return old;
}
@@ -382,10 +381,9 @@ struct mem_cgroup *lookup_swap_cgroup(sw
mappage = ctrl->map[idx];
spin_lock_irqsave(&ctrl->lock, flags);
- sc = kmap_atomic(mappage, KM_USER0);
+ sc = page_address(mappage);
sc += pos;
ret = sc->val;
- kunmap_atomic((void *)sc, KM_USER0);
spin_unlock_irqrestore(&ctrl->lock, flags);
return ret;
}
next prev parent reply other threads:[~2008-11-18 16:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-18 9:07 [PATCH mmotm] memcg: unmap KM_USER0 at shmem_map_and_free_swp if do_swap_account Daisuke Nishimura
2008-11-18 9:26 ` KAMEZAWA Hiroyuki
2008-11-18 10:21 ` Daisuke Nishimura
2008-11-18 12:08 ` Daisuke Nishimura
2008-11-18 12:48 ` Hugh Dickins
2008-11-18 15:17 ` Daisuke Nishimura
2008-11-18 16:12 ` KAMEZAWA Hiroyuki [this message]
2008-11-18 16:40 ` [PATCH mmotm] memcg: avoid using buggy kmap at swap_cgroup Hugh Dickins
2008-11-18 16:56 ` Hugh Dickins
2008-11-19 12:44 ` KAMEZAWA Hiroyuki
2008-11-21 5:54 ` [PATCH] memcg-swap-cgroup-for-remembering-usage-v2.patch KAMEZAWA Hiroyuki
2008-11-21 6:16 ` Daisuke Nishimura
2008-11-21 9:42 ` Daisuke Nishimura
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=6023.10.75.179.61.1227024730.squirrel@webmail-b.css.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
--cc=lizf@cn.fujitsu.com \
--cc=nishimura@mxp.nes.nec.co.jp \
--cc=xemul@openvz.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