LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   kswapd 100% CPU (https://www.linuxquestions.org/questions/linux-server-73/kswapd-100-cpu-687451/)

wassim_dagash 12-01-2008 07:57 AM

kswapd 100% CPU
 
Hi All,
Description:
I countered a weird problem with kswapd:
it runs in some infinite loop trying to swap until order 10 of zone highmem is OK, While zone higmem (as I understand) has nothing to do with continuous memory (cause there is no 1-1 mapping) which means kswapd will continue to try to balance order 10 of zone highmem forever (or until someone release a very large chunk of highmem).
Can anyone please explain me the algorithm of kswapd and why it trys to balance order 10 of zone higmem ?

Details:
I build an instrumented kernel with debug messages in "zone_watermark_ok" function, and from the code and debug messages I see that "zone_watermark_ok" returns 0 when kswapd invokes it (through balance_pgdat) in order to decide if zone highmem is balanced or not, which lead in some configurations to infinite loop of kswapd ( if no large chunks of highmem released) . I added a condition to "balance_pgdat" so it doesn't try to balance order higher than 1 in zone highmem and this conditon solved the problem, what are the risks with such solution? isn't it a bug that kswapd is looking for continuous memory in zone highmem ( as I understand there is no 1-1 mapping in zone highmem which is meaningless in kswapd)?

unSpawn 12-02-2008 05:50 PM

I'm wondering, does only one specific or more kernel versions exhibit this behaviour? Did you ever go on the LKML with this?

wassim_dagash 12-03-2008 12:51 AM

KSWAPD algorithm
 
First thank you for your reply :)
I encountered it on kernel 2.6.18, I don't know how to reach the people in LKML cause as I see it it might be a bug in the KSWAPD algorithm.

unSpawn 12-03-2008 04:12 PM

Quote:

Originally Posted by wassim_dagash (Post 3362649)
I encountered it on kernel 2.6.18

Better try a recent one first then?


Quote:

Originally Posted by wassim_dagash (Post 3362649)
I don't know how to reach the people in LKML

The LKML is at lkml.org. Maybe read http://www.kernel.org/pub/linux/docs/lkml/ before posting.

bslade 11-09-2010 10:31 AM

Is this problem fixed in later versions of Linux
 
Quote:

Originally Posted by wassim_dagash (Post 3360451)
I build an instrumented kernel with debug messages in "zone_watermark_ok" function, and from the code and debug messages I see that "zone_watermark_ok" returns 0 when kswapd invokes it (through balance_pgdat) in order to decide if zone highmem is balanced or not, which lead in some configurations to infinite loop of kswapd ( if no large chunks of highmem released) . I added a condition to "balance_pgdat" so it doesn't try to balance order higher than 1 in zone highmem and this conditon solved the problem, what are the risks with such solution? isn't it a bug that kswapd is looking for continuous memory in zone highmem ( as I understand there is no 1-1 mapping in zone highmem which is meaningless in kswapd)?

I know this is years later, but I'm having what seems like a similar problem with Linux kernel version 2.6.18 although I don't have the capability to instrument the kernel to be sure.

There is a patch available titled "prevent kswapd from freeing excessive amounts of lowmem", which I think is in the 2.6.24 kernel.

wassim_dagash, did a later version of Linux fix your problem?

Ben Slade

wassim_dagash 11-10-2010 01:27 AM

Hey,
Version 2.6.18 does NOT include any patches regarding this issue, if I recall correctly it would be added on 2.6.32 or later.


All times are GMT -5. The time now is 07:22 AM.