Subject: Re: [PATCH] powerpc/mm: Fix RECLAIM_DISTANCE

From: Gavin Shan <[email-masked]>
Date: Tue, 31 Jan 2017 16:30:06 +1100

On Tue, Jan 31, 2017 at 03:58:16PM +1100, Anton Blanchard wrote:
>Hi,
>
>
>> Anton, I think the behaviour looks good. Actually, it's not very
>> relevant to the issue addressed by the patch. I will reply to
>> Michael's reply about the reason. There are two nodes in your system
>> and the memory is expected to be allocated from node-0. If node-0
>> doesn't have enough free memory, the allocater switches to node-1. It
>> means we need more stress.
>
>Did you try setting zone_reclaim_mode? Surely we should reclaim local
>clean pagecache if enabled?
>

In last experiment, I didn't enable zone_reclaim_mode. After changed it to 0x2
(RECLAIM_WRITE), the local pagecache isn't reclaimed from node-0 as we observed
before.

root@P83-p1:~# cat /proc/sys/vm/zone_reclaim_mode
2
root@P83-p1:~# sync
root@P83-p1:~# echo 3 > /proc/sys/vm/drop_caches
root@P83-p1:~# taskset -c 0 cat /tmp/file.8G > /dev/null
root@P83-p1:~# grep FilePages /sys/devices/system/node/node0/meminfo 
Node 0 FilePages:       8497920 kB
root@P83-p1:~# taskset -c 0 ./alloc 68719476736
root@P83-p1:~# grep FilePages /sys/devices/system/node/node0/meminfo 
Node 0 FilePages:       8497920 kB

With the patch applied, the local pagecache is reclaimed:

root@P83-p1:~# cat /proc/sys/vm/zone_reclaim_mode
2
root@P83-p1:~# sync
root@P83-p1:~# echo 3 > /proc/sys/vm/drop_caches
root@P83-p1:~# taskset -c 0 cat /tmp/file.8G > /dev/null
root@P83-p1:~# grep FilePages /sys/devices/system/node/node0/meminfo
Node 0 FilePages:       8441472 kB
root@P83-p1:~# taskset -c 0 ./alloc 68719476736
root@P83-p1:~# grep FilePages /sys/devices/system/node/node0/meminfo
Node 0 FilePages:        712960 kB

Thanks,
Gavin