> On May 4, 2018, 4:53 p.m., Qian Zhang wrote: > > Thanks for the patch! > > > > The `doXxx()` functions seem a bit strange to me. I am wondering if we can > > follow the similar way of how Mesos containerizer calls isolators, e.g., we > > could rename `Subsystem` to `SubsystemProcess` and all the `XxxSubsystem` > > to `XxxSubsystemProcess` since they are all actually `Process`, and then > > introduce a new class `Subsystem` which internally dispatches calls to > > `SubsystemProcess`, and `CgroupsIsolatorProcess` always directly calls the > > functions of `Subsystem`. > > Benjamin Bannier wrote: > Like outlined in the ticket, that would be the other possibility. Note > that we not only require dedicated subsystem processes, but also wrappers > derived from `Subsystem` for each one (we could use a template here to remove > duplicating classes). This could still lead to a lot of duplication in terms > of e.g., functions to implement. I got the feeling that the change here was > less invasive. Let me know if you think the code is too strange and I can > reiterate. > > Gilbert Song wrote: > Duplications are tolerable. Let's follow Qian's advice if possible.
> Note that we not only require dedicated subsystem processes, but also > wrappers derived from Subsystem for each one. Mind to elaborate a bit on why we need wrappers derived from `Subsystem` class for each one? I think we only need a `Subsystem` class but create multiple objects of it (one for each subsystem), and `Subsystem` should have a member variable `process`, and member functions of `Subsystem` just dispatch calls to the related functions of `process`. - Qian ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/66635/#review202424 ----------------------------------------------------------- On April 16, 2018, 11:03 p.m., Benjamin Bannier wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/66635/ > ----------------------------------------------------------- > > (Updated April 16, 2018, 11:03 p.m.) > > > Review request for mesos, Gilbert Song, haosdent huang, and Jie Yu. > > > Bugs: MESOS-8786 > https://issues.apache.org/jira/browse/MESOS-8786 > > > Repository: mesos > > > Description > ------- > > Access to cgroups subsystem-specific isolators is modelled with actors > which e.g., dispatch to themself on asynchronous code paths. We > previously allowed callers to directly invoke functions on these > actors which could e.g., introduce races on instance-internal data. > > In this patch we refactor the `Subsystem` base class to provide a safe > interface. The abstract base class and its concrete, derived classes > are still libprocess processes, but we now use a template method > pattern where the base class only provides a non-`virtual` `public` > interface and all customization points are `protected`. With that we > can inject the needed `dispatch` in the base class, rendering the > class hierarchy safe to use in concurrent contexts. > > > Diffs > ----- > > src/slave/containerizer/mesos/isolators/cgroups/subsystem.hpp > 65c1e47a569f320b63b54e5f4fc1da374d02ee0d > src/slave/containerizer/mesos/isolators/cgroups/subsystem.cpp > 9afa02b207e6272836e5a36d69fb48f1f4d02150 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/blkio.hpp > ebddf4e9812c7e1eecec99215dfa5fd8e4e6e361 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/blkio.cpp > cba21ede59916b0a6e120ecd2b6348b8a946c507 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.hpp > 282a76189579d3ddd61f4aad210ce8e876ff0c25 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpu.cpp > 75fab0f1fc7e7403855de0786b8c1155d7599b7f > src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.hpp > e4977da476a04a708a2e9b9dcc5a2f85da5867f4 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/cpuacct.cpp > 3be419ad477e9baa329b5388d4c12fa743c7f563 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.hpp > 4ab224e3b55a9d2b37d5e9abe94c069d89cd6d80 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp > 4c43191251d7411d14ed8b11c79a64ff5d6ccd76 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/memory.hpp > d79fda3cf852e50e75dbeeeaeae50b1f471a55a4 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/memory.cpp > 50348d63f6fffa7662e6b91b5ce4ff730380e708 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/net_cls.hpp > bcaa16142c4e9882dea88e70095cfb7f223401ef > src/slave/containerizer/mesos/isolators/cgroups/subsystems/net_cls.cpp > f778a419e15940d92079d04884887615322791f5 > src/slave/containerizer/mesos/isolators/cgroups/subsystems/perf_event.hpp > 14c0e79f045fb826d20e476772e017439977dded > src/slave/containerizer/mesos/isolators/cgroups/subsystems/perf_event.cpp > d394d793c6bc38e249530c54ddb868ecff7f7865 > > > Diff: https://reviews.apache.org/r/66635/diff/2/ > > > Testing > ------- > > `make check` > > > Thanks, > > Benjamin Bannier > >