/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * Licensed 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. */ #include <folly/io/HugePages.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> #include <cctype> #include <cstring> #include <algorithm> #include <stdexcept> #include <system_error> #include <boost/regex.hpp> #include <folly/Conv.h> #include <folly/CppAttributes.h> #include <folly/Format.h> #include <folly/Range.h> #include <folly/String.h> #include <folly/gen/Base.h> #include <folly/gen/File.h> #include <folly/gen/String.h> namespace folly { namespace { // Get the default huge page size size_t getDefaultHugePageSize() { … } // Get raw huge page sizes (without mount points, they'll be filled later) HugePageSizeVec readRawHugePageSizes() { … } // Parse the value of a pagesize mount option // Format: number, optional K/M/G/T suffix, trailing junk allowed size_t parsePageSizeValue(StringPiece value) { … } /** * Get list of supported huge page sizes and their mount points, if * hugetlbfs file systems are mounted for those sizes. */ HugePageSizeVec readHugePageSizes() { … } } // namespace const HugePageSizeVec& getHugePageSizes() { … } const HugePageSize* getHugePageSize(size_t size) { … } const HugePageSize* getHugePageSizeForDevice(dev_t device) { … } } // namespace folly