lkml.org 
[lkml]   [2005]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3][Fix] swsusp: prevent swsusp from failing if there's too many pagedir pages
Hi!

> There's a silent assumption in swsusp that always
> sizeof(struct swsusp_info) <= PAGE_SIZE, which is wrong, because
> eg. on x86-64 sizeof(swp_entry_t) = 8. This causes swsusp to skip some pagedir
> pages while reading the image if there are too many of them (depending on the
> architecture, approx. 500 on x86-64).

Last time I did the math, swsusp_info could cover a *lot* of
memory. It was wrong not to check for overflow, but I do not think we
want to introduce *yet another* linklist.

Lets see...

for i386, we have 768 pagedir entries. Each pagedir entry points to
page with 1023 pointers to pages. That means that up-to 768*1023*4096
bytes image can be saved to swap ~= 768 * 1K * 4K ~= 3 GB. That's more
than enough for i386.

for x86-64, we can have 128 pagedir entries (could not we fit more
there? 384 entries should fit, no?). Each pagedir entry has 511
pointers to pages (IIRC)... that is up-to 128*511*4K ~= 64*1K*4K = 256
MB image. Hmm, that should still be enough for any 512MB machine, and
probably okay for much bigger machines, too...

We can still get to 768 MB image (good enough for any 1.5GB machine,
and probably for anything else, too).

If that is not good enough for you, can you simply allocate more than
1 page for swsusp_info? No need for linklists yet.

Andrew, please drop this one. It is too complex solution for quite a
simple problem.
Pavel
--
if you have sharp zaurus hardware you don't need... you know my address
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-26 12:36    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site