On Wed, 18 May 2022 18:09:54 GMT, Severin Gehwolf <sgehw...@openjdk.org> wrote:

>> src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp line 92:
>> 
>>> 90:           }
>>> 91:           ss.print_raw(_root, last_matching_slash_pos);
>>> 92:           _path = os::strdup(ss.base());
>> 
>> Do you mean `Find the longest common prefix`? Maybe give an example in the 
>> comments? Text parsing in C code is really difficult to understand.
>
> @iklam yes I meant `Find the longest common prefix`. Fixed the comment.

I'm not convinced the extra function makes the code more readable, but here it 
is. I can revert back if this is too much.

>> test/hotspot/gtest/runtime/test_os_linux_cgroups.cpp line 63:
>> 
>>> 61:     ASSERT_STREQ(expected_cg_paths[i], ctrl->subsystem_path());
>>> 62:   }
>>> 63: }
>> 
>> I found it hard to relate the different paths. Could you create a new struct 
>> like this?
>> 
>> 
>> struct TestCase {
>>     char* mount_path;
>>     char* root_paths;
>>     char* cgroup_path;
>>     char* expected_cg_paths;
>> } = {
>>   {  "/sys/fs/cgroup/memory",     // mount
>>        "/",                       // root,
>>        ....
>
> Yes, makes sense. Will do.

Done now.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8629

Reply via email to