DPDK 메모리 관리 1: 구조 체
                                            
 7091 단어  DPDK
                    
먼저 DPDK 메모리 와 관련 된 구조 체 를 익 혀 보 세 요.
/**
 * the structure for the memory configuration for the RTE.
 * Used by the rte_config structure. It is separated out, as for multi-process
 * support, the memory details should be shared across instances
 */
struct rte_mem_config {
    volatile uint32_t magic;   /**< Magic number - Sanity check. */
    /* memory topology */
    uint32_t nchannel;    /**< Number of channels (0 if unknown). */
    uint32_t nrank;       /**< Number of ranks (0 if unknown). */
    /**
     * current lock nest order
     *  - qlock->mlock (ring/hash/lpm)
     *  - mplock->qlock->mlock (mempool)
     * Notice:
     *  *ALWAYS* obtain qlock first if having to obtain both qlock and mlock
     */
    rte_rwlock_t mlock;   /**< only used by memzone LIB for thread-safe. */
    rte_rwlock_t qlock;   /**< used for tailq operation for thread safe. */
    rte_rwlock_t mplock;  /**< only used by mempool LIB for thread-safe. */
    uint32_t memzone_cnt; /**< Number of allocated memzones */
    /* memory segments and zones */
    struct rte_memseg memseg[RTE_MAX_MEMSEG];    /**< Physmem descriptors. */
    struct rte_memzone memzone[RTE_MAX_MEMZONE]; /**< Memzone descriptors. */
    struct rte_tailq_head tailq_head[RTE_MAX_TAILQ]; /**< Tailqs for objects */
    /* Heaps of Malloc per socket */
    struct malloc_heap malloc_heaps[RTE_MAX_NUMA_NODES];
    /* address of mem_config in primary process. used to map shared config into
     * exact same address the primary process maps it.
     */
    uint64_t mem_cfg_addr;
} __attribute__((__packed__));/**
 * Physical memory segment descriptor.
 */
struct rte_memseg {
    phys_addr_t phys_addr;      /**< Start physical address.   memseg       hugepage       */
    union {
        void *addr;         /**< Start virtual address.  hugepage          ,               ,       phys_addr。 */
        uint64_t addr_64;   /**< Makes sure addr is always 64 bits */
    };
#ifdef RTE_LIBRTE_IVSHMEM
    phys_addr_t ioremap_addr; /**< Real physical address inside the VM */
#endif
    size_t len;               /**< Length of the segment. memseg      size*/
    uint64_t hugepage_sz;       /**< The pagesize of underlying memory      size 2M /1G? */
    int32_t socket_id;          /**< NUMA socket ID. */
    uint32_t nchannel;          /**< Number of channels. */
    uint32_t nrank;             /**< Number of ranks. */
#ifdef RTE_LIBRTE_XEN_DOM0
     /**< store segment MFNs */
    uint64_t mfn[DOM0_NUM_MEMBLOCK];
#endif
} __rte_packed;/**
 * A structure describing a memzone, which is a contiguous portion of
 * physical memory identified by a name.
 */
struct rte_memzone {
#define RTE_MEMZONE_NAMESIZE 32       /**< Maximum length of memory zone name.*/
    char name[RTE_MEMZONE_NAMESIZE];  /**< Name of the memory zone. */
    phys_addr_t phys_addr;            /**< Start physical address. */
    union {
        void *addr;                   /**< Start virtual address. */
        uint64_t addr_64;             /**< Makes sure addr is always 64-bits */
    };
#ifdef RTE_LIBRTE_IVSHMEM
    phys_addr_t ioremap_addr;         /**< Real physical address inside the VM */
#endif
    size_t len;                       /**< Length of the memzone. */
    uint64_t hugepage_sz;             /**< The page size of underlying memory */
    int32_t socket_id;                /**< NUMA socket ID. */
    uint32_t flags;                   /**< Characteristics of this memzone. */
    uint32_t memseg_id;               /**< Memseg it belongs. */
} __attribute__((__packed__));이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
DPDK - CLI 명령 행 모듈명령 행 초기 화 명령 행 해석 명령 행 의 인자 명령 행 의 기능 DPDK App 을 개발 할 때 DPDK 가 제공 하 는 CLI 도 구 를 이용 하여 프로그램 에 명령 행 을 추가 할 수 있 습 니 다.네 부분 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.