Subject: Re: swsusp: fix error handling in "not enough swap space"

Hi

I am unable to suspend to swap nowdays, getting message 'not enough
swapspace'.
My swap space is 1172704k in size (1GB).

nalesnik:~# fdisk -l /dev/hda

Disk /dev/hda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 146 1172713+ 82 Linux swap
/dev/hda2 147 1605 11719417+ 83 Linux
/dev/hda3 1606 4864 26177917+ 83 Linux


Here's the message I got after issuing 'echo "4" >/proc/acpi/sleep':

...

/critical section: counting pages to copy..[nosave pfn
0x463].................................................................
(pages needed: 10056+512=10568 free: 18599)
Alloc pagedir
..[nosave pfn 0x463]...............................critical section/:
done (10056 pages copied)
blk: queue c6d40e00, I/O limit 4095Mb (mask 0xffffffff)
Writing data to swap (10056 pages): .<0> Kernel panic:
Not enough swapspace when writing data
_


this is PCG-C1VE sony vaio picture book, dmesg attached. Kernel version
2.6.6-rc2-bk2.




Attachments:
dmesg.txt.bz2 (4.87 kB)

2004-04-24 03:47:09

by Nigel Cunningham

[permalink] [raw]
Subject: Re: swsusp: fix error handling in "not enough swap space"

Hi.

Can we assume you've tried running mkswap again? Could you also show
/proc/meminfo prior to suspending?

Regards,

Nigel

--
Nigel Cunningham
C/- Westminster Presbyterian Church Belconnen
61 Templeton Street, Cook, ACT 2614, Australia.
+61 (2) 6251 7727 (wk)

Subject: Re: swsusp: fix error handling in "not enough swap space"

Nigel Cunningham wrote:

> Hi.
>
> Can we assume you've tried running mkswap again? Could you also show
> /proc/meminfo prior to suspending?

Looking into code, quite frankly I can assume that my computer would
have to eat up 900MB of swap. Very unquite as whole thing hangs whem
swap usage is twice memory. Simply due to slow HD, wait times are far
too long for him to cope with it.

with swap redone (swapoff /dev/hda1 && mkswap -v1 /dev/hda1 && swapon
/dev/hda1), still the same happends.


meminfo:

nalesnik:~# cat /proc/meminfo
MemTotal: 109568 kB
MemFree: 36544 kB
Buffers: 15576 kB
Cached: 30360 kB
SwapCached: 0 kB
Active: 36464 kB
Inactive: 19436 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 109568 kB
LowFree: 36544 kB
SwapTotal: 1172704 kB
SwapFree: 1172704 kB
Dirty: 16 kB
Writeback: 0 kB
Mapped: 16632 kB
Slab: 10672 kB
Committed_AS: 22584 kB
PageTables: 512 kB
VmallocTotal: 925656 kB
VmallocUsed: 4784 kB
VmallocChunk: 920548 kB
HugePages_Total: 0
HugePages_Free: 0
Hugepagesize: 4096 kB


2004-04-24 04:33:11

by Nigel Cunningham

[permalink] [raw]
Subject: Re: swsusp: fix error handling in "not enough swap space"

Hmm.

I agree with you; it does sound like the process of eating memory is
grabbing all the swap. I can't see how it could be doing that, however. If
you really want to use Pavel's version, I'd suggest adding some more debug
statements. Perhaps print out the number of swap pages free at the start
of that loop.

Regards,

Nigel


--
Nigel Cunningham
C/- Westminster Presbyterian Church Belconnen
61 Templeton Street, Cook, ACT 2614, Australia.
+61 (2) 6251 7727 (wk)

Subject: Re: swsusp: fix error handling in "not enough swap space"

Nigel Cunningham wrote:

> Hmm.
>
> I agree with you; it does sound like the process of eating memory is
> grabbing all the swap. I can't see how it could be doing that,
> however. If you really want to use Pavel's version, I'd suggest
> adding some more debug statements. Perhaps print out the number of
> swap pages free at the start of that loop.
>
Ok, now funny bit happends. Simple program like that:
while(1){
char *a=malloc(1024*1024*16);
if (a==NULL)
break;
}

can allocate only about 200MB, than exits. That's the fist thing.
Second one, starting KDE, and when swap usage != 0 (just to be sure
there is no problem with any assumption), gives me loads of error
messages (see attached file).

Very bizzare behavior.



Attachments:
syslog.bz2 (3.64 kB)

2004-04-24 18:32:52

by Pavel Machek

[permalink] [raw]
Subject: Re: swsusp: fix error handling in "not enough swap space"

Hi!

> this is PCG-C1VE sony vaio picture book, dmesg attached. Kernel version
> 2.6.6-rc2-bk2.

Did it work okay with 2.6.5?
Pavel

--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

2004-04-24 18:35:23

by Pavel Machek

[permalink] [raw]
Subject: Re: swsusp: fix error handling in "not enough swap space"

Hi!

> >I agree with you; it does sound like the process of eating memory is
> >grabbing all the swap. I can't see how it could be doing that,
> >however. If you really want to use Pavel's version, I'd suggest
> >adding some more debug statements. Perhaps print out the number of
> >swap pages free at the start of that loop.
> >
> Ok, now funny bit happends. Simple program like that:
> while(1){
> char *a=malloc(1024*1024*16);
> if (a==NULL)
> break;
> }
>
> can allocate only about 200MB, than exits. That's the fist thing.

That's bad. That's even without swsusp, right? Again, test on 2.6.5
and post test case. Something is probably wrong in 2.6.6-bk.

> Second one, starting KDE, and when swap usage != 0 (just to be sure
> there is no problem with any assumption), gives me loads of error
> messages (see attached file).

Can you try CONFIG_PREEMPT=n?
Pavel

--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

Subject: Re: swsusp: fix error handling in "not enough swap space"

Pavel Machek wrote:

>Hi!
>
>
>
>>this is PCG-C1VE sony vaio picture book, dmesg attached. Kernel version
>>2.6.6-rc2-bk2.
>>
>>
>
>Did it work okay with 2.6.5?
>
>
I did not tried it at that point.
I can switch back to 2.6.5 and see in the minute.

--
GJ

Subject: Re: swsusp: fix error handling in "not enough swap space"

Pavel Machek wrote:

>That's bad. That's even without swsusp, right? Again, test on 2.6.5
>and post test case. Something is probably wrong in 2.6.6-bk.
>
>
Yes, it is working fine on 2.6.5. I can investigate my self in spare
time. If you have any ideas, hints, or test procedures I can follow,
tell me. I know C very good.

--
GJ

Subject: Re: swsusp: fix error handling in "not enough swap space"

Pavel Machek wrote:

>>Second one, starting KDE, and when swap usage != 0 (just to be sure
>>there is no problem with any assumption), gives me loads of error
>>messages (see attached file).
>>
>>
>
>Can you try CONFIG_PREEMPT=n?
>
>
Funny, now it doesn't run BUG(), but, instead I have two way behavior.
Either he is complaining that bash
will not stop !! or that there is not enough pages free. Both wrong and
bizzareus. This really needs fixing before 2.6.6 is out (imo).


1:

Apr 25 09:47:58 nalesnik kernel: Stopping tasks:
========================================================================
Apr 25 09:47:58 nalesnik kernel: stopping tasks failed (1 tasks remaining)
Apr 25 09:47:58 nalesnik kernel: Suspend failed: Not all processes stopped!
Apr 25 09:47:58 nalesnik kernel: Restarting tasks...<6> Strange, bash
not stopped


2:

Apr 25 10:53:52 nalesnik kernel: Stopping tasks:
=======================================================================|
Apr 25 10:53:52 nalesnik kernel: Freeing memory: ..........|
Apr 25 10:53:52 nalesnik kernel: /critical section: counting pages to
copy..[nosave pfn 0x44d]........................... (pages needed:
24493+512=25005 free: 4162)
Apr 25 10:53:52 nalesnik kernel: Suspend Machine: Couldn't get enough
free pages, on 20843 pages short
Apr 25 10:53:52 nalesnik kernel: Suspend Machine: Suspend failed, trying
to recover...
Apr 25 10:53:52 nalesnik kernel: blk: queue c6d40e00, I/O limit 4095Mb
(mask 0xffffffff)
Apr 25 10:53:52 nalesnik kernel: Fixing swap signatures... ok
Apr 25 10:53:52 nalesnik kernel: Restarting tasks... done



--
GJ

2004-04-25 20:45:21

by Pavel Machek

[permalink] [raw]
Subject: Re: swsusp: fix error handling in "not enough swap space"

Hi!

> >>Second one, starting KDE, and when swap usage != 0 (just to be sure
> >>there is no problem with any assumption), gives me loads of error
> >>messages (see attached file).
> >>
> >>
> >
> >Can you try CONFIG_PREEMPT=n?
> >
> >
> Funny, now it doesn't run BUG(), but, instead I have two way behavior.
> Either he is complaining that bash
> will not stop !! or that there is not enough pages free. Both wrong and
> bizzareus. This really needs fixing before 2.6.6 is out (imo).

Dump stack at time when process refuses to stop, and see why it can't
be stopped. Then fix that :-).
Pavel

--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

2004-04-25 20:46:28

by Pavel Machek

[permalink] [raw]
Subject: Re: swsusp: fix error handling in "not enough swap space"

Hi!

> >That's bad. That's even without swsusp, right? Again, test on 2.6.5
> >and post test case. Something is probably wrong in 2.6.6-bk.
> >
> >
> Yes, it is working fine on 2.6.5. I can investigate my self in spare
> time. If you have any ideas, hints, or test procedures I can follow,
> tell me. I know C very good.

Try get akpm's attetion, send him your test program. I'm not mm/ guru,
he'll probably point you to a good starting place (or probably fix it
himself quickly).
Pavel
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

Subject: Re: swsusp: fix error handling in "not enough swap space"

Pavel Machek wrote:

>Hi!
>
>
>
>>>>Second one, starting KDE, and when swap usage != 0 (just to be sure
>>>>there is no problem with any assumption), gives me loads of error
>>>>messages (see attached file).
>>>>
>>>>
>>>>
>>>>
>>>Can you try CONFIG_PREEMPT=n?
>>>
>>>
>>>
>>>
>>Funny, now it doesn't run BUG(), but, instead I have two way behavior.
>>Either he is complaining that bash
>>will not stop !! or that there is not enough pages free. Both wrong and
>>bizzareus. This really needs fixing before 2.6.6 is out (imo).
>>
>>
>
>Dump stack at time when process refuses to stop, and see why it can't
>be stopped. Then fix that :-).
>
>
Quite easy to say. I don't really understeand all changes that 've been
done over mm between 2.6.6-rc2-bk2 and 2.6.5.
But from my tests today, it looks like processes locked (?) in kernel
are not getting freezed.

Simple example. Mount something over nfs, than disconnect your network
cable, and inside that dir run ls.
Kernel will not be able to freeze bash !!, obvioulsy bug. I'll try to
investigate it my self, but if someone can get with fast explanation, to
enlight me problem, that would be nice.
Nfs is maybe a tougth example. Try i.e. dd bs=1 (to make it slower)
if=/proc/kmem of=/dev/null,
or even open mc, and press F3 on /proc/kmem, providing that your
machines is slow. At that point, MC on my computer eats about 900MB of
swap ! (I have only 128MB of ram, so it's quite strange). Anyways,
echo "4" >/proc/acpi/sleep, and kernel will not be able to freeze it.

--
GJ


2004-04-26 20:32:53

by Pavel Machek

[permalink] [raw]
Subject: Re: swsusp: fix error handling in "not enough swap space"

Hi!

> >>Funny, now it doesn't run BUG(), but, instead I have two way behavior.
> >>Either he is complaining that bash
> >>will not stop !! or that there is not enough pages free. Both wrong and
> >>bizzareus. This really needs fixing before 2.6.6 is out (imo).
> >
> >Dump stack at time when process refuses to stop, and see why it can't
> >be stopped. Then fix that :-).
> >
> Quite easy to say. I don't really understeand all changes that 've been
> done over mm between 2.6.6-rc2-bk2 and 2.6.5.

I know its easy to say ;-).

> Simple example. Mount something over nfs, than disconnect your network
> cable, and inside that dir run ls.
> Kernel will not be able to freeze bash !!, obvioulsy bug. I'll try to
> investigate it my self, but if someone can get with fast explanation, to
> enlight me problem, that would be nice.

Not obviously, and try to use less "!"s.

If you disconnect your /dev/hda, you'll not be able to suspend. Bug?
I'd call it design decision that allows me to keep it reasonably
simply. And I'd say that disconnected nfs is similar issue.

Anyway, feel free to submit a patch, and if it is simple enough, I'll
probably take it.

> Nfs is maybe a tougth example. Try i.e. dd bs=1 (to make it slower)
> if=/proc/kmem of=/dev/null,
> or even open mc, and press F3 on /proc/kmem, providing that your
> machines is slow. At that point, MC on my computer eats about 900MB of
> swap ! (I have only 128MB of ram, so it's quite strange). Anyways,
> echo "4" >/proc/acpi/sleep, and kernel will not be able to freeze
> it.

If you do something stupid, its okay that kernel is not able to
suspend. F3 on /dev/kmem counts as "something stupid". If you find out
something normal user (not root) can do... we are more likely to fix
that.

I'd say that /dev/kmem issue is not worth fixing. NFS issue may be
worth fixing, but I do not use NFS that much. Any other problems?

Pavel
--
934a471f20d6580d5aad759bf0d97ddc