Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controllers/cpuset_memory_spread: #831

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guohui0712
Copy link

When the cpuset_mem_hog program is run and
the number of FilePages in the process is counted,
the Page Cache of other processes interferes with the process,
causing the use case to fail
Other Page Cache comes from two aspects:

  1. After releasing Page Cache and slab cache:
    echo 3> /proc/sys/vm/drop_caches,
    some processes or kernel threads will reload files into Page Cache
  2. During the running of the cpuset_mem_hog program,
    there will be some processes using Page Cache

amendment:
1, The first type of Page Cache: solve it by adding a delay after
the echo 3> /proc/sys/vm/drop_caches command is executed:
sleep 3 # 3 is an empirical value, and it may have a
different value without the environment
2, The second type of Page Cache: by modifying the strategy,
create a new sys: /dev/cpuset/cpuset/sys under the cpuset in the cgroup,
and then add all user processes except cpuset_mem_hog to the cgroup,
and set the strategy for the CPU and memory nodes
Same as /dev/cpuset/cpuset/1

When the cpuset_mem_hog program is run and
the number of FilePages in the process is counted,
the Page Cache of other processes interferes with the process,
causing the use case to fail
Other Page Cache comes from two aspects:
1. After releasing Page Cache and slab cache:
   echo 3> /proc/sys/vm/drop_caches,
   some processes or kernel threads will reload files into Page Cache
2. During the running of the cpuset_mem_hog program,
   there will be some processes using Page Cache

amendment:
1, The first type of Page Cache: solve it by adding a delay after
   the echo 3> /proc/sys/vm/drop_caches command is executed:
   sleep 3 # 3 is an empirical value, and it may have a
   different value without the environment
2, The second type of Page Cache: by modifying the strategy,
   create a new sys: /dev/cpuset/cpuset/sys under the cpuset in the cgroup,
   and then add all user processes except cpuset_mem_hog to the cgroup,
   and set the strategy for the CPU and memory nodes
   Same as /dev/cpuset/cpuset/1
@richiejp
Copy link
Contributor

Hi, thanks for the PR. There are some issues which I will comment on the code.

Copy link
Contributor

@richiejp richiejp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the general approach is correct. BTW it would be better to submit this to the mailing list, so a number of recent contributors to these tests can see it.

@@ -187,15 +187,23 @@ cleanup()

find "$CPUSET" -type d | sort | sed -n '2,$p' | tac | while read subdir
do
if [ "$subdir" != "/dev/cpuset/sys" ]; then
while read pid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While should be indented.

@@ -187,15 +187,23 @@ cleanup()

find "$CPUSET" -type d | sort | sed -n '2,$p' | tac | while read subdir
do
if [ "$subdir" != "/dev/cpuset/sys" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use $CPUSET?

fi

if [ "$subdir" == "/dev/cpuset/sys" ]; then
cgdelete -r cpuset:sys
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is cgdelete?

It is not a shell function or program I have installed.

@@ -194,6 +194,7 @@ result_check()
general_memory_spread_test()
{
local cpusetpath="$CPUSET/1"
local cpusetpathsys="$CPUSET/sys"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there appears to be an extra indent. Maybe you are mixing tabs and spaces?

return 1
fi

array=`ps -elf |grep -v "\["|awk '{print $4}'|xargs echo`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this supposed to do and is it the simplest way to do it?

For example, could you do this by reading cgroup.procs or tasks in the root group or just using ps?

Also after we move all these processes, do they get moved back to where they came from?

Do we split the memory nodes between between group 1 and sys? I guess that one or more nodes need to be excluded from the test and assigned to sys. Assuming there are enough nodes available on the machine.

@@ -224,6 +244,7 @@ general_memory_spread_test()
# we'd better drop the caches before we test page cache.
sync
/bin/echo 3 > /proc/sys/vm/drop_caches 2> $CPUSET_TMP/stderr
sleep 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the same thing be achieved by writing to /proc/sys/vm/stat_refresh?

Note that stat_refresh is not available on older kernels, in which case you can fall back to sleeping.

@ZhangHongchen1
Copy link
Contributor

@guohui0712 @richiejp I encountered the same problem, when I adjusted the lowerlimit from 2000 to 5000, the problem disappeared.
I think the reason of the FAIL case is random events (minimal probability) and get_memsinfo(before send SIGUSR1) and account_ meminfo (after read FIFO).
So I think we can just increase the lowerlimit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants