美文网首页Linux知识点汇集
内存管理相关概念

内存管理相关概念

作者: vincent_0425 | 来源:发表于2019-03-17 17:32 被阅读0次

    1. NUMA与UMA

    简而言之,UMA的IO、存储是共享方式,通过系统总线共享访问,主要限制是扩展性不好,当处理器容量增加时,会导致效率降低(因为都通过总线访问);而NUMA不同在于处理器被划分成多个节点,每个节点有自己的本地内存资源,当本地内存资源不够时可使用其它节点的存储资源,访问本地资源快于其它节点资源;
    服务器体系(SMP, NUMA, MPP)与共享存储器架构(UMA和NUMA)

    2. NUMA内存划分

    屏幕快照 2019-03-17 17.31.36.png
    • pg_data_t节点,每个节点关联到系统中每个处理器;若是UMA结果,这里只有一个节点;
    • 内存域是ZONES指代的部分,有三个列表,分别对应不同的类型:
    enum zone_type {
    #ifdef CONFIG_ZONE_DMA
        /*
         * ZONE_DMA is used when there are devices that are not able
         * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
         * carve out the portion of memory that is needed for these devices.
         * The range is arch specific.
         *
         * Some examples
         *
         * Architecture     Limit
         * ---------------------------
         * parisc, ia64, sparc  <4G
         * s390         <2G
         * arm          Various
         * alpha        Unlimited or 0-16MB.
         *
         * i386, x86_64 and multiple other arches
         *          <16M.
         */
        ZONE_DMA,
    #endif
    #ifdef CONFIG_ZONE_DMA32
        /*
         * x86_64 needs two ZONE_DMAs because it supports devices that are
         * only able to do DMA to the lower 16M but also 32 bit devices that
         * can only do DMA areas below 4G.
         */
        ZONE_DMA32,
    #endif
        /*
         * Normal addressable memory is in ZONE_NORMAL. DMA operations can be
         * performed on pages in ZONE_NORMAL if the DMA devices support
         * transfers to all addressable memory.
         */
        ZONE_NORMAL,
    #ifdef CONFIG_HIGHMEM
        /*
         * A memory area that is only addressable by the kernel through
         * mapping portions into its own address space. This is for example
         * used by i386 to allow the kernel to address the memory beyond
         * 900MB. The kernel will set up special mappings (page
         * table entries on i386) for each page that the kernel needs to
         * access.
         */
        ZONE_HIGHMEM,
    #endif
          // 在防止内存碎片中的伪内存域。
        ZONE_MOVABLE,
    #ifdef CONFIG_ZONE_DEVICE
        ZONE_DEVICE,
    #endif
        __MAX_NR_ZONES // 结束标志
    };
    
    1. DMA部分标记适合DMA的内存域, 在i386, x86_64下是16M。DMA之理解;
    2. ZONE_DMA32 标记使用32位字可寻址、适合DMA的内存域;32位机器上为空,在AMD64上是0到4G;
    3. ZONE_NORMAL标记可直接映射到内核段的普通域;
    4. ZONE_HIGHMEM标记超出内核段的物理内存;

    各个内存域都关联了一个数组,用于组织属于该内存域的物理内存页: struct page
    同时,每个节点除了分配本节点的内存外,还会有个备用列表(包含其它节点内存域)用于本节点内存用尽时备用(struct zonelist)

    相关文章

      网友评论

        本文标题:内存管理相关概念

        本文链接:https://www.haomeiwen.com/subject/ciiumqtx.html