root/opal/mca/mpool/hugepage/mpool_hugepage.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2013 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2006      Voltaire. All rights reserved.
  14  * Copyright (c) 2011-2018 Los Alamos National Security, LLC. All rights
  15  *                         reserved.
  16  *
  17  * $COPYRIGHT$
  18  *
  19  * Additional copyrights may follow
  20  *
  21  * $HEADER$
  22  */
  23 /**
  24  * @file
  25  */
  26 #ifndef MCA_MPOOL_HUGEPAGE_H
  27 #define MCA_MPOOL_HUGEPAGE_H
  28 
  29 #include "opal_config.h"
  30 #include "opal/class/opal_list.h"
  31 #include "opal/class/opal_free_list.h"
  32 #include "opal/class/opal_rb_tree.h"
  33 #include "opal/mca/event/event.h"
  34 #include "opal/mca/mpool/mpool.h"
  35 #include "opal/util/proc.h"
  36 #include "opal/mca/allocator/allocator.h"
  37 #include "opal/util/sys_limits.h"
  38 
  39 BEGIN_C_DECLS
  40 struct mca_mpool_hugepage_module_t;
  41 typedef struct mca_mpool_hugepage_module_t mca_mpool_hugepage_module_t;
  42 
  43 struct mca_mpool_hugepage_component_t {
  44     mca_mpool_base_component_t super;
  45     bool print_stats;
  46     opal_list_t huge_pages;
  47     mca_mpool_hugepage_module_t *modules;
  48     int module_count;
  49     opal_atomic_size_t bytes_allocated;
  50 };
  51 typedef struct mca_mpool_hugepage_component_t mca_mpool_hugepage_component_t;
  52 
  53 OPAL_DECLSPEC extern mca_mpool_hugepage_component_t mca_mpool_hugepage_component;
  54 
  55 struct mca_mpool_hugepage_module_t;
  56 
  57 struct mca_mpool_hugepage_hugepage_t {
  58     /** opal list item superclass */
  59     opal_list_item_t super;
  60     /** page size in bytes */
  61     unsigned long    page_size;
  62     /** path for mmapped files */
  63     char            *path;
  64     /** counter to help ensure unique file names for mmaped files */
  65     opal_atomic_int32_t count;
  66     /** some platforms allow allocation of hugepages through mmap flags */
  67     int              mmap_flags;
  68 };
  69 typedef struct mca_mpool_hugepage_hugepage_t mca_mpool_hugepage_hugepage_t;
  70 
  71 OBJ_CLASS_DECLARATION(mca_mpool_hugepage_hugepage_t);
  72 
  73 struct mca_mpool_hugepage_module_t {
  74     mca_mpool_base_module_t super;
  75     mca_mpool_hugepage_hugepage_t *huge_page;
  76     mca_allocator_base_module_t *allocator;
  77     opal_mutex_t lock;
  78     opal_rb_tree_t allocation_tree;
  79 };
  80 
  81 /*
  82  *  Initializes the mpool module.
  83  */
  84 int mca_mpool_hugepage_module_init (mca_mpool_hugepage_module_t *mpool,
  85                                     mca_mpool_hugepage_hugepage_t *huge_page);
  86 
  87 void *mca_mpool_hugepage_seg_alloc (void *ctx, size_t *sizep);
  88 void mca_mpool_hugepage_seg_free (void *ctx, void *addr);
  89 
  90 END_C_DECLS
  91 #endif

/* [<][>][^][v][top][bottom][index][help] */