From patchwork Sat Jul 14 03:04:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Torvalds X-Patchwork-Id: 10524319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B15036020A for ; Sat, 14 Jul 2018 03:04:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A97728F6B for ; Sat, 14 Jul 2018 03:04:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E6F529081; Sat, 14 Jul 2018 03:04:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBB0928F6B for ; Sat, 14 Jul 2018 03:04:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECF746B000A; Fri, 13 Jul 2018 23:04:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E80436B000C; Fri, 13 Jul 2018 23:04:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D964B6B000D; Fri, 13 Jul 2018 23:04:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io0-f200.google.com (mail-io0-f200.google.com [209.85.223.200]) by kanga.kvack.org (Postfix) with ESMTP id AF3C86B000A for ; Fri, 13 Jul 2018 23:04:33 -0400 (EDT) Received: by mail-io0-f200.google.com with SMTP id x14-v6so29273991ioa.6 for ; Fri, 13 Jul 2018 20:04:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:mime-version:references :in-reply-to:from:date:message-id:subject:to:cc; bh=3GyU2VtfFDBOgR5cFI6HATDeCcOMsr/lYjtUKuPpseE=; b=qkD4J3O4yMzwcvG9EOeh933AtmqmxDkNDNOUuWajEMo7e03k+5UGmnb9q++NJfTVlH 0vi4FqfkL71nesRy3FnRn67VL9DDuify7cxjN9fKECtCUNGMR3kYCXmQP3FBpqVKU6qc G1SoDPL78h8mHH7j85UzRV4ZSPWGfvsWg7HYphzb4lYmb2eDqavWssEpMXQ1tlgcekYC u7c4gEZ65fRQWWjjDhkSUtxcYoCp7PrxiIYysDupl26aolapGh7RQ47qCPH2q1L+P3oC z1hRLPTHMKThkyLYrJl4VLiAGU5R7rOP5SJ8GIoaglKZGcJdr1Iq8yLzuPnkWmSKTBO5 F1Lw== X-Gm-Message-State: AOUpUlF6z9P2+WdzeFaQyX7XqWw0HrZyMd8hDo5pLM8eDrjILBh3b+sR 9bCgyxVrVuo0JkHa7HCpPHKxO4P8Tvx0nlS3yRz/JtVa+PGAz6UME5i7GDwpd08OB43J2lGdLLt 1IoJhnAotYOUNhCJ7J4nU5cBxWOjU8rXhNMd15BKVIqCNZ/pR6ULU8+pLpfjtVbXv+LKeadxYwE uyAZ3Culj02boMpV+PvLbh09vcOXC/GXImjZFWWuQXAZthnj3Wjqki3CxNVonVFVZmPLS5SfnTV 2wSYNOPmJ8mC6vSbt3TD2NQ2VLZzD0xip9hl7UIUEwN/NSAJyx0mzkaMTfj6joE6bMBihZk3WKn 2UMAaVVxhdg5JWqgTlVcyrcFJDmQbM3eG+x9VrM6O8C+nRN1MmQPLg1MoET71xja2EskIgA1Ei5 o X-Received: by 2002:a02:9962:: with SMTP id d31-v6mr7464660jak.1.1531537473539; Fri, 13 Jul 2018 20:04:33 -0700 (PDT) X-Received: by 2002:a02:9962:: with SMTP id d31-v6mr7464641jak.1.1531537473167; Fri, 13 Jul 2018 20:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531537473; cv=none; d=google.com; s=arc-20160816; b=yUdfJVVkyPLZt5ZX/vY/3fIf6wnc8udc0k1EnzOTC314qPC3teYVUJniDvcUO9SEnJ o6RC8DJavLOsepHO8PiP940MmBV5KkPrdSLkNIJiw2MVv3lkMIC8rQgX99YWSSMME/C2 QOkeiQ8NmH168DFScuQvktda3fIUbWxGKmfbimZqPCae67f+PGOG+Z3NTyDJppQr/cCm v1rg0r05qTB2rip6xdr9OrkBocZVtP/jHendWbH9/ZjQMSwCOpQzA+BGUgq6XzGjegAw cXmSMlJdx5Vf/S5tSx7SxBngGjqmkfRKAQuu8SHPNtb+s7QJatQjG0+wIEQ/GZNXHCAp hkOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature:arc-authentication-results; bh=3GyU2VtfFDBOgR5cFI6HATDeCcOMsr/lYjtUKuPpseE=; b=JHISv90R/H/Ept9erKIlMM4fDna+tu1Nas8wDEcdHPs33QQ2s22EwhXeuIY5KVAPq8 C5nBc2BN2T19i+18/0Bxl0VIML3KvEvw75Zd4irmOwmQnVHdPn0bQ03IwtB3X1Dh2fnS Zuf+AezNbtkaCm+M3r+P72eq/x2mRs+wBU0XeEWV6Nea4B9RXE+Sw/apO32tLPX7d66m qGU5tnB7WKDQkCq20+4RructSHgQOeVzUJbwvqXoqvlOXBB7Enx7kMxnm1SmImByxL2t JHsBORpuXqNC3hCVkJLJiqL1JDyX1MKhQXxphxSlErmDdeiIEhgiSTWOezf66w9CiRbV UpbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SbMZW4On; spf=pass (google.com: domain of linus971@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=linus971@gmail.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id p10-v6sor5810334iom.22.2018.07.13.20.04.33 for (Google Transport Security); Fri, 13 Jul 2018 20:04:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linus971@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SbMZW4On; spf=pass (google.com: domain of linus971@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=linus971@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3GyU2VtfFDBOgR5cFI6HATDeCcOMsr/lYjtUKuPpseE=; b=SbMZW4Onf/XBC1Il+mXSzgUk6pcX/CEWhbJOnEDixR3lBMrA8rWs8ZNTtd/eEqnk/f ywrb+CXNwohd0IVKjuv2aTEmlvkGTNEsvIogSm10kKtR4LOIY0C7u9lBgPqghUp0sjtz ezGyKLry6LAaXIxJmzHqYNM/yVrqkvMDG9Ni8= X-Google-Smtp-Source: AAOMgpdTFxLnF4gdtdRk3l6K4f6Wz/pMvFjLaVo2zM9TGbRT0YLBIm2ZcBYEtUtzD7ePTme6BaM8JdrK2UJrUTj9PzM= X-Received: by 2002:a6b:7a05:: with SMTP id h5-v6mr18394796iom.238.1531537472729; Fri, 13 Jul 2018 20:04:32 -0700 (PDT) MIME-Version: 1.0 References: <20180713164804.fc2c27ccbac4c02ca2c8b984@linux-foundation.org> <20180713165812.ec391548ffeead96725d044c@linux-foundation.org> <9b93d48c-b997-01f7-2fd6-6e35301ef263@oracle.com> <5edf2d71-f548-98f9-16dd-b7fed29f4869@oracle.com> In-Reply-To: From: Linus Torvalds Date: Fri, 13 Jul 2018 20:04:21 -0700 Message-ID: Subject: Re: Instability in current -git tree To: Pavel Tatashin Cc: Andrew Morton , Thomas Gleixner , Matthew Wilcox , Ingo Molnar , Jens Axboe , Greg Kroah-Hartman , David Miller , Al Viro , Dave Airlie , Tejun Heo , "Ted Ts'o" , Mike Snitzer , linux-mm , Daniel Vacek , Mel Gorman X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jul 13, 2018 at 7:40 PM Linus Torvalds wrote: > > Should we perhaps just revert > > 124049decbb1 x86/e820: put !E820_TYPE_RAM regions into memblock.reserved > f7f99100d8d9 mm: stop zeroing memory during allocation in vmemmap > > it still reverts fairly cleanly (there's a trivial conflict with the > older commit). This is the revert I'm testing right now.. It seems to be stable for me (doing that "limited memory, nasty memory hogs" test that I did before), but I'll keep running this for a while. Even with the memory limit and the memory hogs, it sometimes took some time to crash. Linus arch/x86/kernel/e820.c | 15 +++------------ mm/page_alloc.c | 1 - mm/sparse-vmemmap.c | 23 ++++++----------------- mm/sparse.c | 6 +++--- 4 files changed, 12 insertions(+), 33 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index c88c23c658c1..d1f25c831447 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -1248,7 +1248,6 @@ void __init e820__memblock_setup(void) { int i; u64 end; - u64 addr = 0; /* * The bootstrap memblock region count maximum is 128 entries @@ -1265,21 +1264,13 @@ void __init e820__memblock_setup(void) struct e820_entry *entry = &e820_table->entries[i]; end = entry->addr + entry->size; - if (addr < entry->addr) - memblock_reserve(addr, entry->addr - addr); - addr = end; if (end != (resource_size_t)end) continue; - /* - * all !E820_TYPE_RAM ranges (including gap ranges) are put - * into memblock.reserved to make sure that struct pages in - * such regions are not left uninitialized after bootup. - */ if (entry->type != E820_TYPE_RAM && entry->type != E820_TYPE_RESERVED_KERN) - memblock_reserve(entry->addr, entry->size); - else - memblock_add(entry->addr, entry->size); + continue; + + memblock_add(entry->addr, entry->size); } /* Throw away partial pages: */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1521100f1e63..2fe859726f9a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1171,7 +1171,6 @@ static void free_one_page(struct zone *zone, static void __meminit __init_single_page(struct page *page, unsigned long pfn, unsigned long zone, int nid) { - mm_zero_struct_page(page); set_page_links(page, zone, nid, pfn); init_page_count(page); page_mapcount_reset(page); diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index bd0276d5f66b..c363c60be7d3 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c @@ -42,7 +42,7 @@ static void * __ref __earlyonly_bootmem_alloc(int node, unsigned long align, unsigned long goal) { - return memblock_virt_alloc_try_nid_raw(size, align, goal, + return memblock_virt_alloc_try_nid(size, align, goal, BOOTMEM_ALLOC_ACCESSIBLE, node); } @@ -53,7 +53,7 @@ void * __meminit vmemmap_alloc_block(unsigned long size, int node) { /* If the main allocator is up use that, fallback to bootmem. */ if (slab_is_available()) { - gfp_t gfp_mask = GFP_KERNEL|__GFP_RETRY_MAYFAIL|__GFP_NOWARN; + gfp_t gfp_mask = GFP_KERNEL|__GFP_ZERO|__GFP_RETRY_MAYFAIL|__GFP_NOWARN; int order = get_order(size); static bool warned; struct page *page; @@ -165,22 +165,11 @@ pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node) return pte; } -static void * __meminit vmemmap_alloc_block_zero(unsigned long size, int node) -{ - void *p = vmemmap_alloc_block(size, node); - - if (!p) - return NULL; - memset(p, 0, size); - - return p; -} - pmd_t * __meminit vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node) { pmd_t *pmd = pmd_offset(pud, addr); if (pmd_none(*pmd)) { - void *p = vmemmap_alloc_block_zero(PAGE_SIZE, node); + void *p = vmemmap_alloc_block(PAGE_SIZE, node); if (!p) return NULL; pmd_populate_kernel(&init_mm, pmd, p); @@ -192,7 +181,7 @@ pud_t * __meminit vmemmap_pud_populate(p4d_t *p4d, unsigned long addr, int node) { pud_t *pud = pud_offset(p4d, addr); if (pud_none(*pud)) { - void *p = vmemmap_alloc_block_zero(PAGE_SIZE, node); + void *p = vmemmap_alloc_block(PAGE_SIZE, node); if (!p) return NULL; pud_populate(&init_mm, pud, p); @@ -204,7 +193,7 @@ p4d_t * __meminit vmemmap_p4d_populate(pgd_t *pgd, unsigned long addr, int node) { p4d_t *p4d = p4d_offset(pgd, addr); if (p4d_none(*p4d)) { - void *p = vmemmap_alloc_block_zero(PAGE_SIZE, node); + void *p = vmemmap_alloc_block(PAGE_SIZE, node); if (!p) return NULL; p4d_populate(&init_mm, p4d, p); @@ -216,7 +205,7 @@ pgd_t * __meminit vmemmap_pgd_populate(unsigned long addr, int node) { pgd_t *pgd = pgd_offset_k(addr); if (pgd_none(*pgd)) { - void *p = vmemmap_alloc_block_zero(PAGE_SIZE, node); + void *p = vmemmap_alloc_block(PAGE_SIZE, node); if (!p) return NULL; pgd_populate(&init_mm, pgd, p); diff --git a/mm/sparse.c b/mm/sparse.c index f13f2723950a..4cc1558fd10c 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -419,9 +419,9 @@ void __init sparse_mem_maps_populate_node(struct page **map_map, unsigned long size = sizeof(struct page) * PAGES_PER_SECTION; size = PAGE_ALIGN(size); - map = memblock_virt_alloc_try_nid_raw(size * map_count, - PAGE_SIZE, __pa(MAX_DMA_ADDRESS), - BOOTMEM_ALLOC_ACCESSIBLE, nodeid); + map = memblock_virt_alloc_try_nid(size * map_count, + PAGE_SIZE, __pa(MAX_DMA_ADDRESS), + BOOTMEM_ALLOC_ACCESSIBLE, nodeid); if (map) { for (pnum = pnum_begin; pnum < pnum_end; pnum++) { if (!present_section_nr(pnum))