From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2280DC433E0 for ; Fri, 25 Dec 2020 07:59:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF3652312F for ; Fri, 25 Dec 2020 07:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728817AbgLYH7S (ORCPT ); Fri, 25 Dec 2020 02:59:18 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9650 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727200AbgLYH7R (ORCPT ); Fri, 25 Dec 2020 02:59:17 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4D2K6y53PWz15hnb; Fri, 25 Dec 2020 15:57:46 +0800 (CST) Received: from [10.174.177.80] (10.174.177.80) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Fri, 25 Dec 2020 15:58:22 +0800 Subject: Re: [PATCH v9 11/12] mm/vmalloc: Hugepage vmalloc mappings To: Nicholas Piggin , , Andrew Morton CC: , , , Zefan Li , "Jonathan Cameron" , Christoph Hellwig , Christophe Leroy , Rick Edgecombe References: <20201205065725.1286370-1-npiggin@gmail.com> <20201205065725.1286370-12-npiggin@gmail.com> From: Ding Tianhong Message-ID: <7db7564c-0600-33d9-68d9-61fa6fc1bc0d@huawei.com> Date: Fri, 25 Dec 2020 15:58:23 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 In-Reply-To: <20201205065725.1286370-12-npiggin@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.80] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +again: > + size = PAGE_ALIGN(size); > + area = __get_vm_area_node(size, align, VM_ALLOC | VM_UNINITIALIZED | > vm_flags, start, end, node, gfp_mask, caller); > if (!area) > goto fail; > > - addr = __vmalloc_area_node(area, gfp_mask, prot, node); > + addr = __vmalloc_area_node(area, gfp_mask, prot, shift, node); > if (!addr) > - return NULL; > + goto fail; > > /* > * In this function, newly allocated vm_struct has VM_UNINITIALIZED > @@ -2788,8 +2878,19 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, > return addr; > > fail: > - warn_alloc(gfp_mask, NULL, > + if (shift > PAGE_SHIFT) { > + free_vm_area(area); > + shift = PAGE_SHIFT; > + align = real_align; > + size = real_size; > + goto again; > + } > + Hi, Nicholas: I met a problem like this: [ 67.103584] ------------[ cut here ]------------ [ 67.103884] kernel BUG at vmalloc.c:2892! [ 67.104387] Internal error: Oops - BUG: 0 [#1] SMP [ 67.104942] Process insmod (pid: 1161, stack limit = 0x(____ptrval____)) [ 67.105356] CPU: 2 PID: 1161 Comm: insmod Tainted: G O 4.19.95+ #9 [ 67.105702] Hardware name: linux,dummy-virt (DT) [ 67.106006] pstate: a0000005 (NzCv daif -PAN -UAO) [ 67.106285] pc : free_vm_area+0x78/0x80 [ 67.106549] lr : free_vm_area+0x58/0x80 it looks like when __vmalloc_area_node failed, the area is already released, and the free_vm_area will release the vm area again, so trigger the problem. 3405 ret = remove_vm_area(area->addr); 3406 BUG_ON(ret != area); 3407 kfree(area); Ding > + if (!area) { > + /* Warn for area allocation, page allocations already warn */ > + warn_alloc(gfp_mask, NULL, > "vmalloc: allocation failure: %lu bytes", real_size); > + } > return NULL; > } > >