Re: Memory corruption during hibernation since 2.6.31

From: KAMEZAWA Hiroyuki
Date: Wed Jul 28 2010 - 21:11:17 EST


On Wed, 28 Jul 2010 23:38:09 +0200
Ondrej Zary <linux@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Wednesday 28 July 2010 23:34:07 Rafael J. Wysocki wrote:
> > On Wednesday, July 28, 2010, Ondrej Zary wrote:
> > > Hello,
> > > after very long bisection, I finally found what's causing memory
> > > corruption during hibernation on my machine sice 2.6.31:
> > > https://bugzilla.kernel.org/show_bug.cgi?id=15753
> > >
> > > It's commit c9e444103b5e7a5a3519f9913f59767f92e33baf (mm: reuse unused
> > > swap entry if necessary).
> > >
> > > I don't know anything about swapping in Linux so I don't have a clue
> > > what's wrong with that commit.
> >
> > Thanks for bisecting!
> >
> > This looks rather serious. I'd be grateful from any clues from the mm guys
> > involved (CCed).
> >
> > Do you use s2disk or the built-in hibernation code?
>
> I use built-in code (echo disk >/sys/power/state). The machine has 256MB RAM
> and 256MB swap partition.
>

I don't know much about hibernation but it seems my code break something, sorry.

The commit does
if swap_map[] shows that there is only SwapCache, no real swap users,
try to reuse it by detaching a page from SwapCache.

In usual cases,

lock_page(page):
add_to_swap(page); // assign swap offset and mark as SwapCache
try_to_unmap(); // swap's usage count +1 (swap_duplicate())
unlock_page(page);

Then, SwapCache will not be reused in usual cases.

What code should I look into ? kernel/power/swap.c ??

Thanks,
-Kame





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/