* KSWAPD Algorithm
@ 2008-12-03 7:02 wassim dagash
2008-12-03 14:51 ` Andi Kleen
0 siblings, 1 reply; 3+ messages in thread
From: wassim dagash @ 2008-12-03 7:02 UTC (permalink / raw)
To: linux-kernel
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 contiguous physical 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 tries
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)?
Regards,
Wassim Dagash.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: KSWAPD Algorithm
2008-12-03 7:02 KSWAPD Algorithm wassim dagash
@ 2008-12-03 14:51 ` Andi Kleen
2008-12-04 4:54 ` KAMEZAWA Hiroyuki
0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2008-12-03 14:51 UTC (permalink / raw)
To: wassim dagash; +Cc: linux-kernel
"wassim dagash" <wassim.dagash@gmail.com> writes:
> 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 contiguous physical 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 tries
> to balance order 10 of zone higmem ?
hugetlbfs requires large continuous mappings even in highmem
to map 2MB pages or similar to user space.
However order 10 seems pretty high, normally that's only order 8
on a i386 system.
-Andi
--
ak@linux.intel.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: KSWAPD Algorithm
2008-12-03 14:51 ` Andi Kleen
@ 2008-12-04 4:54 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 3+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-12-04 4:54 UTC (permalink / raw)
To: Andi Kleen; +Cc: wassim dagash, linux-kernel, kosaki.motohiro@jp.fujitsu.com
On Wed, 03 Dec 2008 15:51:11 +0100
Andi Kleen <andi@firstfloor.org> wrote:
> "wassim dagash" <wassim.dagash@gmail.com> writes:
>
> > 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 contiguous physical 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 tries
> > to balance order 10 of zone higmem ?
>
> hugetlbfs requires large continuous mappings even in highmem
> to map 2MB pages or similar to user space.
> However order 10 seems pretty high, normally that's only order 8
> on a i386 system.
>
Reading Kosaki's explanation, it seems
- order-10 allocation occurs at ZONE_NORMAL.
- kswapd is kicked with order=10.
wakeup_kswaps(zone, 10) -> pgdat->kswapd_max_order = 10.
- kswapd(balance_pgdat()) does
if (!zone_watermark_ok(zone, order, zone->pages_high, end_zone, 0))
all_zones_ok = 0;
And this "zone" is all zone, i.e. DMA, NORMAL, HIGHMEM.
Then, loop again,
if (!all_zones_ok) {
cond_resched();
try_to_freeze();
goto loop_again;
}
Maybe...
-Kame
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-04 4:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-03 7:02 KSWAPD Algorithm wassim dagash
2008-12-03 14:51 ` Andi Kleen
2008-12-04 4:54 ` KAMEZAWA Hiroyuki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox