主頁 > 作業系統 > Linux-3.14.12記憶體管理筆記【構建記憶體管理框架(2)】

Linux-3.14.12記憶體管理筆記【構建記憶體管理框架(2)】

2020-09-14 15:20:53 作業系統

前面構建記憶體管理框架,已經將記憶體管理node節點設定完畢,接下來將是管理區和頁面管理的構建,此處代碼實作主要在于setup_arch()下的一處鉤子:x86_init.paging.pagetable_init(),據前面分析可知x86_init結構體內該鉤子實際上掛接的是native_pagetable_init()函式,

native_pagetable_init():

【file:/arch/x86/mm/init_32.c】
void __init native_pagetable_init(void)
{
    unsigned long pfn, va;
    pgd_t *pgd, *base = swapper_pg_dir;
    pud_t *pud;
    pmd_t *pmd;
    pte_t *pte;
 
    /*
     * Remove any mappings which extend past the end of physical
     * memory from the boot time page table.
     * In virtual address space, we should have at least two pages
     * from VMALLOC_END to pkmap or fixmap according to VMALLOC_END
     * definition. And max_low_pfn is set to VMALLOC_END physical
     * address. If initial memory mapping is doing right job, we
     * should have pte used near max_low_pfn or one pmd is not present.
     */
    for (pfn = max_low_pfn; pfn < 1<<(32-PAGE_SHIFT); pfn++) {
        va = PAGE_OFFSET + (pfn<<PAGE_SHIFT);
        pgd = base + pgd_index(va);
        if (!pgd_present(*pgd))
            break;
 
        pud = pud_offset(pgd, va);
        pmd = pmd_offset(pud, va);
        if (!pmd_present(*pmd))
            break;
 
        /* should not be large page here */
        if (pmd_large(*pmd)) {
            pr_warn("try to clear pte for ram above max_low_pfn: pfn: %lx pmd: %p pmd phys: %lx, but pmd is big page and is not using pte !\n",
                pfn, pmd, __pa(pmd));
            BUG_ON(1);
        }
 
        pte = pte_offset_kernel(pmd, va);
        if (!pte_present(*pte))
            break;
 
        printk(KERN_DEBUG "clearing pte for ram above max_low_pfn: pfn: %lx pmd: %p pmd phys: %lx pte: %p pte phys: %lx\n",
                pfn, pmd, __pa(pmd), pte, __pa(pte));
        pte_clear(NULL, va, pte);
    }
    paravirt_alloc_pmd(&init_mm, __pa(base) >> PAGE_SHIFT);
    paging_init();
}

該函式的for回圈主要是用于檢測max_low_pfn直接映射空間后面的物理記憶體是否存在系統啟動引導時創建的頁表,如果存在,則使用pte_clear()將其清除,

接下來的paravirt_alloc_pmd()主要是用于準虛擬化,主要是使用鉤子函式的方式替換x86環境中多種多樣的指令實作,

再往下的paging_init():

【file:/arch/x86/mm/init_32.c】
/*
 * paging_init() sets up the page tables - note that the first 8MB are
 * already mapped by head.S.
 *
 * This routines also unmaps the page at virtual kernel address 0, so
 * that we can trap those pesky NULL-reference errors in the kernel.
 */
void __init paging_init(void)
{
    pagetable_init();
 
    __flush_tlb_all();
 
    kmap_init();
 
    /*
     * NOTE: at this point the bootmem allocator is fully available.
     */
    olpc_dt_build_devicetree();
    sparse_memory_present_with_active_regions(MAX_NUMNODES);
    sparse_init();
    zone_sizes_init();
}

paging_init()主要都是函式呼叫,現在逐一分析各個函式功能,先看pagetable_init():

【file:/arch/x86/mm/init_32.c】
static void __init pagetable_init(void)
{
    pgd_t *pgd_base = swapper_pg_dir;
 
    permanent_kmaps_init(pgd_base);
}

其中kmap_get_fixmap_pte():

【file:/arch/x86/mm/init_32.c】
static inline pte_t *kmap_get_fixmap_pte(unsigned long vaddr)
{
    return pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr),
            vaddr), vaddr), vaddr);
}

可以很容易看到kmap_init()主要是獲取到臨時映射區間的起始頁表并往臨時映射頁表變數kmap_pte置值,并置頁表屬性kmap_prot為PAGE_KERNEL,

paging_init()中,由于沒有開啟CONFIG_OLPC配置,故olpc_dt_build_devicetree()為空函式,暫不分析,同樣,前面提及的sparse_memory_present_with_active_regions()和sparse_init()也暫不分析,

最后看一下zone_sizes_init():

【file:/arch/x86/mm/init.c】
void __init zone_sizes_init(void)
{
    unsigned long max_zone_pfns[MAX_NR_ZONES];
 
    memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
 
#ifdef CONFIG_ZONE_DMA
    max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN;
#endif
#ifdef CONFIG_ZONE_DMA32
    max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
#endif
    max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
#ifdef CONFIG_HIGHMEM
    max_zone_pfns[ZONE_HIGHMEM] = max_pfn;
#endif
 
    free_area_init_nodes(max_zone_pfns);
}

通過max_zone_pfns獲取各個管理區的最大頁面數,并作為引數呼叫free_area_init_nodes(),其中free_area_init_nodes()函式實作:

【file:/mm/page_alloc.c】
/**
 * free_area_init_nodes - Initialise all pg_data_t and zone data
 * @max_zone_pfn: an array of max PFNs for each zone
 *
 * This will call free_area_init_node() for each active node in the system.
 * Using the page ranges provided by add_active_range(), the size of each
 * zone in each node and their holes is calculated. If the maximum PFN
 * between two adjacent zones match, it is assumed that the zone is empty.
 * For example, if arch_max_dma_pfn == arch_max_dma32_pfn, it is assumed
 * that arch_max_dma32_pfn has no pages. It is also assumed that a zone
 * starts where the previous one ended. For example, ZONE_DMA32 starts
 * at arch_max_dma_pfn.
 */
void __init free_area_init_nodes(unsigned long *max_zone_pfn)
{
    unsigned long start_pfn, end_pfn;
    int i, nid;
 
    /* Record where the zone boundaries are */
    memset(arch_zone_lowest_possible_pfn, 0,
                sizeof(arch_zone_lowest_possible_pfn));
    memset(arch_zone_highest_possible_pfn, 0,
                sizeof(arch_zone_highest_possible_pfn));
    arch_zone_lowest_possible_pfn[0] = find_min_pfn_with_active_regions();
    arch_zone_highest_possible_pfn[0] = max_zone_pfn[0];
    for (i = 1; i < MAX_NR_ZONES; i++) {
        if (i == ZONE_MOVABLE)
            continue;
        arch_zone_lowest_possible_pfn[i] =
            arch_zone_highest_possible_pfn[i-1];
        arch_zone_highest_possible_pfn[i] =
            max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]);
    }
    arch_zone_lowest_possible_pfn[ZONE_MOVABLE] = 0;
    arch_zone_highest_possible_pfn[ZONE_MOVABLE] = 0;
 
    /* Find the PFNs that ZONE_MOVABLE begins at in each node */
    memset(zone_movable_pfn, 0, sizeof(zone_movable_pfn));
    find_zone_movable_pfns_for_nodes();
 
    /* Print out the zone ranges */
    printk("Zone ranges:\n");
    for (i = 0; i < MAX_NR_ZONES; i++) {
        if (i == ZONE_MOVABLE)
            continue;
        printk(KERN_CONT " %-8s ", zone_names[i]);
        if (arch_zone_lowest_possible_pfn[i] ==
                arch_zone_highest_possible_pfn[i])
            printk(KERN_CONT "empty\n");
        else
            printk(KERN_CONT "[mem %0#10lx-%0#10lx]\n",
                arch_zone_lowest_possible_pfn[i] << PAGE_SHIFT,
                (arch_zone_highest_possible_pfn[i]
                    << PAGE_SHIFT) - 1);
    }
 
    /* Print out the PFNs ZONE_MOVABLE begins at in each node */
    printk("Movable zone start for each node\n");
    for (i = 0; i < MAX_NUMNODES; i++) {
        if (zone_movable_pfn[i])
            printk(" Node %d: %#010lx\n", i,
                   zone_movable_pfn[i] << PAGE_SHIFT);
    }
 
    /* Print out the early node map */
    printk("Early memory node ranges\n");
    for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid)
        printk(" node %3d: [mem %#010lx-%#010lx]\n", nid,
               start_pfn << PAGE_SHIFT, (end_pfn << PAGE_SHIFT) - 1);
 
    /* Initialise every node */
    mminit_verify_pageflags_layout();
    setup_nr_node_ids();
    for_each_online_node(nid) {
        pg_data_t *pgdat = NODE_DATA(nid);
        free_area_init_node(nid, NULL,
                find_min_pfn_for_node(nid), NULL);
 
        /* Any memory on that node */
        if (pgdat->node_present_pages)
            node_set_state(nid, N_MEMORY);
        check_for_memory(pgdat, nid);
    }
}

該函式中,arch_zone_lowest_possible_pfn用于存盤各記憶體管理區可使用的最小記憶體頁框號,而arch_zone_highest_possible_pfn則是用來存盤各記憶體管理區可使用的最大記憶體頁框號,于是find_min_pfn_with_active_regions()函式主要是實作用于獲取最小記憶體頁框號,而獲取最大記憶體頁框號則是緊隨的for回圈:

for (i = 1; i < MAX_NR_ZONES; i++) {

    if (i == ZONE_MOVABLE)

        continue;

    arch_zone_lowest_possible_pfn[i] =

        arch_zone_highest_possible_pfn[i-1];

    arch_zone_highest_possible_pfn[i] =

        max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]);

}

該回圈里面除了確定各記憶體管理區最大記憶體頁框號,同時也確定了各管理區的最小記憶體頁框號,實際上就是確定各個管理區的上下邊界,此外,還有一個全域陣列zone_movable_pfn,用于記錄各個node節點的Movable管理區的起始頁框號,而查找該頁框號的相應函式為find_zone_movable_pfns_for_nodes(),

具體實作:

【file:/mm/page_alloc.c】
/*
 * Find the PFN the Movable zone begins in each node. Kernel memory
 * is spread evenly between nodes as long as the nodes have enough
 * memory. When they don't, some nodes will have more kernelcore than
 * others
 */
static void __init find_zone_movable_pfns_for_nodes(void)
{
    int i, nid;
    unsigned long usable_startpfn;
    unsigned long kernelcore_node, kernelcore_remaining;
    /* save the state before borrow the nodemask */
    nodemask_t saved_node_state = node_states[N_MEMORY];
    unsigned long totalpages = early_calculate_totalpages();
    int usable_nodes = nodes_weight(node_states[N_MEMORY]);
    struct memblock_type *type = &memblock.memory;
 
    /* Need to find movable_zone earlier when movable_node is specified. */
    find_usable_zone_for_movable();
 
    /*
     * If movable_node is specified, ignore kernelcore and movablecore
     * options.
     */
    if (movable_node_is_enabled()) {
        for (i = 0; i < type->cnt; i++) {
            if (!memblock_is_hotpluggable(&type->regions[i]))
                continue;
 
            nid = type->regions[i].nid;
 
            usable_startpfn = PFN_DOWN(type->regions[i].base);
            zone_movable_pfn[nid] = zone_movable_pfn[nid] ?
                min(usable_startpfn, zone_movable_pfn[nid]) :
                usable_startpfn;
        }
 
        goto out2;
    }
 
    /*
     * If movablecore=nn[KMG] was specified, calculate what size of
     * kernelcore that corresponds so that memory usable for
     * any allocation type is evenly spread. If both kernelcore
     * and movablecore are specified, then the value of kernelcore
     * will be used for required_kernelcore if it's greater than
     * what movablecore would have allowed.
     */
    if (required_movablecore) {
        unsigned long corepages;
 
        /*
         * Round-up so that ZONE_MOVABLE is at least as large as what
         * was requested by the user
         */
        required_movablecore =
            roundup(required_movablecore, MAX_ORDER_NR_PAGES);
        corepages = totalpages - required_movablecore;
 
        required_kernelcore = max(required_kernelcore, corepages);
    }
 
    /* If kernelcore was not specified, there is no ZONE_MOVABLE */
    if (!required_kernelcore)
        goto out;
 
    /* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */
    usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone];
 
restart:
    /* Spread kernelcore memory as evenly as possible throughout nodes */
    kernelcore_node = required_kernelcore / usable_nodes;
    for_each_node_state(nid, N_MEMORY) {
        unsigned long start_pfn, end_pfn;
 
        /*
         * Recalculate kernelcore_node if the division per node
         * now exceeds what is necessary to satisfy the requested
         * amount of memory for the kernel
         */
        if (required_kernelcore < kernelcore_node)
            kernelcore_node = required_kernelcore / usable_nodes;
 
        /*
         * As the map is walked, we track how much memory is usable
         * by the kernel using kernelcore_remaining. When it is
         * 0, the rest of the node is usable by ZONE_MOVABLE
         */
        kernelcore_remaining = kernelcore_node;
 
        /* Go through each range of PFNs within this node */
        for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) {
            unsigned long size_pages;
 
            start_pfn = max(start_pfn, zone_movable_pfn[nid]);
            if (start_pfn >= end_pfn)
                continue;
 
            /* Account for what is only usable for kernelcore */
            if (start_pfn < usable_startpfn) {
                unsigned long kernel_pages;
                kernel_pages = min(end_pfn, usable_startpfn)
                                - start_pfn;
 
                kernelcore_remaining -= min(kernel_pages,
                            kernelcore_remaining);
                required_kernelcore -= min(kernel_pages,
                            required_kernelcore);
 
                /* Continue if range is now fully accounted */
                if (end_pfn <= usable_startpfn) {
 
                    /*
                     * Push zone_movable_pfn to the end so
                     * that if we have to rebalance
                     * kernelcore across nodes, we will
                     * not double account here
                     */
                    zone_movable_pfn[nid] = end_pfn;
                    continue;
                }
                start_pfn = usable_startpfn;
            }
 
            /*
             * The usable PFN range for ZONE_MOVABLE is from
             * start_pfn->end_pfn. Calculate size_pages as the
             * number of pages used as kernelcore
             */
            size_pages = end_pfn - start_pfn;
            if (size_pages > kernelcore_remaining)
                size_pages = kernelcore_remaining;
            zone_movable_pfn[nid] = start_pfn + size_pages;
 
            /*
             * Some kernelcore has been met, update counts and
             * break if the kernelcore for this node has been
             * satisfied
             */
            required_kernelcore -= min(required_kernelcore,
                                size_pages);
            kernelcore_remaining -= size_pages;
            if (!kernelcore_remaining)
                break;
        }
    }
 
    /*
     * If there is still required_kernelcore, we do another pass with one
     * less node in the count. This will push zone_movable_pfn[nid] further
     * along on the nodes that still have memory until kernelcore is
     * satisfied
     */
    usable_nodes--;
    if (usable_nodes && required_kernelcore > usable_nodes)
        goto restart;
 
out2:
    /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
    for (nid = 0; nid < MAX_NUMNODES; nid++)
        zone_movable_pfn[nid] =
            roundup(zone_movable_pfn[nid], MAX_ORDER_NR_PAGES);
 
out:
    /* restore the node_state */
    node_states[N_MEMORY] = saved_node_state;
}

該函式中early_calculate_totalpages()主要用于統計系統頁面總數,而nodes_weight()則是將當前系統的節點數統計回傳,其入參node_states[N_MEMORY]的定義在page_alloc.c中:

nodemask_t node_states[NR_NODE_STATES] __read_mostly = {

    [N_POSSIBLE] = NODE_MASK_ALL,

    [N_ONLINE] = { { [0] = 1UL } },

#ifndef CONFIG_NUMA

    [N_NORMAL_MEMORY] = { { [0] = 1UL } },

#ifdef CONFIG_HIGHMEM

    [N_HIGH_MEMORY] = { { [0] = 1UL } },

#endif

#ifdef CONFIG_MOVABLE_NODE

    [N_MEMORY] = { { [0] = 1UL } },

#endif

    [N_CPU] = { { [0] = 1UL } },

#endif  /* NUMA */

};

EXPORT_SYMBOL(node_states);

接著往下的find_usable_zone_for_movable():

【file:/mm/page_alloc.c】
/*
 * This finds a zone that can be used for ZONE_MOVABLE pages. The
 * assumption is made that zones within a node are ordered in monotonic
 * increasing memory addresses so that the "highest" populated zone is used
 */
static void __init find_usable_zone_for_movable(void)
{
    int zone_index;
    for (zone_index = MAX_NR_ZONES - 1; zone_index >= 0; zone_index--) {
        if (zone_index == ZONE_MOVABLE)
            continue;
 
        if (arch_zone_highest_possible_pfn[zone_index] >
                arch_zone_lowest_possible_pfn[zone_index])
            break;
    }
 
    VM_BUG_ON(zone_index == -1);
    movable_zone = zone_index;
}

其主要實作查找一個可用于ZONE_MOVABLE頁面的記憶體管理區,該區低于ZONE_MOVABLE且頁面數不為0,通常最高記憶體管理區被找到,然后管理區索引記錄在全域變數movable_zone中,

接下來的if分支:

if (movable_node_is_enabled()) {

    for (i = 0; i < type->cnt; i++) {

        if (!memblock_is_hotpluggable(&type->regions[i]))

            continue;

        nid = type->regions[i].nid;

        usable_startpfn = PFN_DOWN(type->regions[i].base);

        zone_movable_pfn[nid] = zone_movable_pfn[nid] ?

            min(usable_startpfn, zone_movable_pfn[nid]) :

            usable_startpfn;

    }

    goto out2;

}

該分支主要是當movable_node已經設定的情況下,忽略kernelcore和movablecore的設定,找到最高記憶體管理區的起始頁usable_startpfn和Movable管理區的頁框號,

再往下的if分支:

if (!required_kernelcore)

        goto out;

如果至此kernelcore仍未設定時,則表示其實movable管理區是不存在的,

最后在restart的標簽內的代碼,其主要實作的是將kernelcore的記憶體平均分配到各個node上面,其中區域變數kernelcore_node表示各個nodes平均分攤到的記憶體頁面數,usable_startpfn表示movable管理區的最低記憶體頁框號,主要通過遍歷node_states[N_MEMORY]中標志可用的node節點并遍歷節點內的各個記憶體塊資訊,將均攤的記憶體頁面數分到各個node當中,如果無法均攤時,通過判斷:

if (usable_nodes && required_kernelcore > usable_nodes)

        goto restart;

重新再次平均分攤,基于優先滿足kernelcore的設定前提,直至無法滿足條件為止,

而在out2的標簽內的代碼則是用于將movable管理區的起始地址做MAX_ORDER_NR_PAGES對齊操作,

末尾out的標簽則僅是恢復node_states[]而已,

find_zone_movable_pfns_for_nodes()函式雖然分析了這么多,但個人實驗環境由于required_movablecore和required_kernelcore為0,故僅分析這么多了,

下面回到free_area_init_nodes()函式中,跟隨在find_zone_movable_pfns_for_nodes()后面是一段日志資訊內容列印,分別列印管理區范圍資訊(dmesg命令可以查看),個人實驗環境上的資訊為:

image

再往下的mminit_verify_pageflags_layout()函式主要用于記憶體初始化調測使用的,由于未開啟CONFIG_DEBUG_MEMORY_INIT配置項,此函式為空,而setup_nr_node_ids()是用于設定記憶體節點總數的,此處如果最大節點數MAX_NUMNODES不超過1,則是空函式,

free_area_init_nodes()函式末了還有一個遍歷各個節點做初始化的操作,暫且留待后面再分析,

轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/36207.html

標籤:嵌入式

上一篇:痞子衡嵌入式:終于可以放開聊一聊i.MXRT1170這顆劃時代MCU了

下一篇:Linux-3.14.12記憶體管理筆記【構建記憶體管理框架(3)】

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • CA和證書

    1、在 CentOS7 中使用 gpg 創建 RSA 非對稱密鑰對 gpg --gen-key #Centos上生成公鑰/密鑰對(存放在家目錄.gnupg/) 2、將 CentOS7 匯出的公鑰,拷貝到 CentOS8 中,在 CentOS8 中使用 CentOS7 的公鑰加密一個檔案 gpg -a ......

    uj5u.com 2020-09-10 00:09:53 more
  • Kubernetes K8S之資源控制器Job和CronJob詳解

    Kubernetes的資源控制器Job和CronJob詳解與示例 ......

    uj5u.com 2020-09-10 00:10:45 more
  • VMware下安裝CentOS

    VMware下安裝CentOS 一、軟硬體準備 1 Centos鏡像準備 1.1 CentOS鏡像下載地址 下載地址 1.2 CentOS鏡像下載程序 點擊下載地址進入如下圖的網站,選擇需要下載的版本,這里選擇的是Centos8,點擊如圖所示。 決定選擇Centos8后,選擇想要的鏡像源進行下載,此 ......

    uj5u.com 2020-09-10 00:12:10 more
  • 如何使用Grep命令查找多個字串

    如何使用Grep 命令查找多個字串 大家好,我是良許! 今天向大家介紹一個非常有用的技巧,那就是使用 grep 命令查找多個字串。 簡單介紹一下,grep 命令可以理解為是一個功能強大的命令列工具,可以用它在一個或多個輸入檔案中搜索與正則運算式相匹配的文本,然后再將每個匹配的文本用標準輸出的格式 ......

    uj5u.com 2020-09-10 00:12:28 more
  • git配置http代理

    git配置http代理 經常遇到克隆 github 慢的問題,這里記錄一下幾種配置 git 代理的方法,解決 clone github 過慢。 目錄 git配置代理 git單獨配置github代理 git配置全域代理 配置終端環境變數 git配置代理 主要使用 git config 命令 git單獨 ......

    uj5u.com 2020-09-10 00:12:33 more
  • Linux npm install 裝包時提示Error EACCES permission denied解

    npm install 裝包時提示Error EACCES permission denied解決辦法 ......

    uj5u.com 2020-09-10 00:12:53 more
  • Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包

    Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包。 18 (flaskApi) [root@67 flaskDemo]# yum -y install nginx 19 已加載插件:fastestmirror, langpacks 20 Loading ......

    uj5u.com 2020-09-10 00:13:13 more
  • Linux查看服務器暴力破解ssh IP

    在公網的服務器上經常遇到別人爆破你服務器的22埠,用來挖礦或者干其他嘿嘿嘿的事情~ 這種情況下正確的做法是: 修改默認ssh的22埠 使用設定密鑰登錄或者白名單ip登錄 建議服務器密碼為復雜密碼 創建普通用戶登錄服務器(root權限過大) 建立堡壘機,實作統一管理服務器 統計爆破IP [root ......

    uj5u.com 2020-09-10 00:13:17 more
  • CentOS 7系統常見快捷鍵操作方式

    Linux系統中一些常見的快捷方式,可有效提高操作效率,在某些時刻也能避免操作失誤帶來的問題。 ......

    uj5u.com 2020-09-10 00:13:31 more
  • CentOS 7作業系統目錄結構介紹

    作業系統存在著大量的資料檔案資訊,相應檔案資訊會存在于系統相應目錄中,為了更好的管理資料資訊,會將系統進行一些目錄規劃,不同目錄存放不同的資源。 ......

    uj5u.com 2020-09-10 00:13:35 more
最新发布
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:43:21 more
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:42:36 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:26:53 more
  • 設定Windows主機的瀏覽器為wls2的默認瀏覽器

    這里以Chrome為例。 1. 準備作業 wsl是可以使用Windows主機上安裝的exe程式,出于安全考慮,默認情況下改功能是無法使用。要使用的話,終端需要以管理員權限啟動。 我這里以Windows Terminal為例,介紹如何默認使用管理員權限打開終端,具體操作如下圖所示: 2. 操作 wsl ......

    uj5u.com 2023-04-19 09:25:49 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:19:04 more
  • Linux學習筆記

    IP地址和主機名 IP地址 ifconfig可以用來查詢本機的IP地址,如果不能使用,可以通過install net-tools安裝。 Centos系統下ens33表示主網卡;inet后表示IP地址;lo表示本地回環網卡; 127.0.0.1表示代指本機;0.0.0.0可以用于代指本機,同時在放行設 ......

    uj5u.com 2023-04-18 06:52:01 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:50 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:01 more
  • 你是不是暴露了?

    作者:袁首京 原創文章,轉載時請保留此宣告,并給出原文連接。 如果您是計算機相關從業人員,那么應該經歷不止一次網路安全專項檢查了,你肯定是收到過資訊系統技術檢測報告,要求你加強風險監測,確保你提供的系統服務堅實可靠了。 沒檢測到問題還好,檢測到問題的話,有些處理起來還是挺麻煩的,尤其是線上正在運行的 ......

    uj5u.com 2023-04-05 16:52:56 more
  • 細節拉滿,80 張圖帶你一步一步推演 slab 記憶體池的設計與實作

    1. 前文回顧 在之前的幾篇記憶體管理系列文章中,筆者帶大家從宏觀角度完整地梳理了一遍 Linux 記憶體分配的整個鏈路,本文的主題依然是記憶體分配,這一次我們會從微觀的角度來探秘一下 Linux 內核中用于零散小記憶體塊分配的記憶體池 —— slab 分配器。 在本小節中,筆者還是按照以往的風格先帶大家簡單 ......

    uj5u.com 2023-04-05 16:44:11 more