[ https://issues.apache.org/jira/browse/YARN-11692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17846205#comment-17846205 ]
ASF GitHub Bot commented on YARN-11692: --------------------------------------- p-szucs commented on code in PR #6821: URL: https://github.com/apache/hadoop/pull/6821#discussion_r1599517841 ########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/ResourceHandlerModule.java: ########## @@ -63,35 +63,54 @@ public class ResourceHandlerModule { * as resource metrics functionality. We need to ensure that the same * instance is used for both. */ + private static volatile CGroupsHandler cGroupsV1Handler; + private static volatile CGroupsHandler cGroupsV2Handler; private static volatile TrafficControlBandwidthHandlerImpl trafficControlBandwidthHandler; private static volatile NetworkPacketTaggingHandlerImpl networkPacketTaggingHandlerImpl; - private static volatile CGroupsHandler cGroupsHandler; private static volatile CGroupsBlkioResourceHandlerImpl cGroupsBlkioResourceHandler; private static volatile MemoryResourceHandler cGroupsMemoryResourceHandler; private static volatile CpuResourceHandler cGroupsCpuResourceHandler; - /** - * Returns an initialized, thread-safe CGroupsHandler instance. - */ - private static CGroupsHandler getInitializedCGroupsHandler(Configuration conf) + private static void initializeCGroupsHandlers(Configuration conf) throws ResourceHandlerException { + initializeCGroupsV1Handler(conf); + if (cgroupsV2Enabled) { + initializeCGroupsV2Handler(conf); + } + } + + private static void initializeCGroupsV1Handler(Configuration conf) throws ResourceHandlerException { - if (cGroupsHandler == null) { + if (cGroupsV1Handler == null) { synchronized (CGroupsHandler.class) { - if (cGroupsHandler == null) { - cGroupsHandler = cgroupsV2Enabled - ? new CGroupsV2HandlerImpl(conf, PrivilegedOperationExecutor.getInstance(conf)) - : new CGroupsHandlerImpl(conf, PrivilegedOperationExecutor.getInstance(conf)); - LOG.debug("Value of CGroupsHandler is: {}", cGroupsHandler); + if (cGroupsV1Handler == null) { Review Comment: It catched my eye too, but then I found that it is implemented based on the double-checked locking, so I left it there: https://www.baeldung.com/java-singleton-double-checked-locking > Support mixed cgroup v1/v2 controller structure > ----------------------------------------------- > > Key: YARN-11692 > URL: https://issues.apache.org/jira/browse/YARN-11692 > Project: Hadoop YARN > Issue Type: Sub-task > Reporter: Benjamin Teke > Assignee: Peter Szucs > Priority: Major > Labels: pull-request-available > > There were heavy changes on the device side in cgroup v2. To keep supporting > FGPAs and GPUs short term, mixed structures where some of the cgroup > controllers are from v1 while others from v2 should be supported. More info: > https://dropbear.xyz/2023/05/23/devices-with-cgroup-v2/ -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org