rpuch commented on a change in pull request #9569: URL: https://github.com/apache/ignite/pull/9569#discussion_r763709643
########## File path: modules/numa-allocator/src/main/java/org/apache/ignite/mem/NumaAllocator.java ########## @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.mem; + +import java.io.Serializable; +import org.apache.ignite.internal.mem.NumaAllocUtil; + +/** + * NUMA aware memory allocator. Uses {@code libnuma} under the hood. Only Linux distros with {@code libnuma >= 2.0.x} is Review comment: 'are supported'? ########## File path: modules/numa-allocator/src/main/java/org/apache/ignite/mem/SimpleNumaAllocationStrategy.java ########## @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.mem; + +import java.io.Serializable; +import org.apache.ignite.internal.mem.NumaAllocUtil; +import org.apache.ignite.internal.util.tostring.GridToStringBuilder; +import org.apache.ignite.internal.util.tostring.GridToStringInclude; +import org.apache.ignite.internal.util.typedef.internal.A; + +/** + * Simple NUMA allocation strategy. + * <p> + * Use {@link SimpleNumaAllocationStrategy#SimpleNumaAllocationStrategy(int)} to allocate memory on specific NUMA node + * with number equals to {@code node}. Memory will be allocated using {@code void *numa_alloc_onnode(size_t, int)} + * of {@code libnuma}. + * <p> + * Use {@link SimpleNumaAllocationStrategy#SimpleNumaAllocationStrategy()} to allocate memory using default NUMA + * memory policy of current thread. Memory will be allocated using {@code void *numa_alloc(size_t)} of {@code lubnuma}. + * Memory policy could be set by running application with {@code numactl} + */ +public class SimpleNumaAllocationStrategy implements NumaAllocationStrategy, Serializable { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + @GridToStringInclude + private final int node; + + /** */ + public SimpleNumaAllocationStrategy() { + node = Integer.MAX_VALUE; Review comment: A little suggestion: we might introduce a constant like `NOT_SPECIFIED` with the value of `Integer.MAX_VALUE` and use it on lines 47 and 64, this would make it a little bit more obvious what this special value means. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
