From patchwork Sun Dec 4 01:30:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13063707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E435AC352A1 for ; Sun, 4 Dec 2022 01:31:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A2A98E0007; Sat, 3 Dec 2022 20:31:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 852D98E0001; Sat, 3 Dec 2022 20:31:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F3A88E0007; Sat, 3 Dec 2022 20:31:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5E13F8E0001 for ; Sat, 3 Dec 2022 20:31:27 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 31C58AAACC for ; Sun, 4 Dec 2022 01:31:27 +0000 (UTC) X-FDA: 80202896214.02.F7E9D1B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf29.hostedemail.com (Postfix) with ESMTP id D3230120008 for ; Sun, 4 Dec 2022 01:31:26 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="S1Q/1DRW"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670117486; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=p5OPg+DQ4r4Z/JFMiJuaclM/YLWn2Go/JtLJ0xxYwus=; b=cGzDnC8k1ZNv6E99Qp+22QsJtOfmg2srFDvmsH+yOGIB2pxYSmavsyal3AQGeVZlj5LIp9 jLK1goxADs43FmpIa1ok7TI/69lAUfS0JcealkDB5y8B82Be91xhYuHHIQVmTaVBEe/YGR 7lDuFfXfFaJNGtWh8z16GUNCnKoonNE= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="S1Q/1DRW"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670117486; a=rsa-sha256; cv=none; b=w6HuWVUrmBtc/H/6ddXSZRPuUHa9myYZWXnpUFzY48jWdDlrWF1Sf6AcE2zE++GU4CBAig jFkb5qsjA2PuiBc3xNC2//e9/WaVfGZn4W6So8drsn+PcSHj7C3A8hk68s61MSSGsHm66R SVhxdCW03co3CANSc2qBhCnSS6GVNUQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670117486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p5OPg+DQ4r4Z/JFMiJuaclM/YLWn2Go/JtLJ0xxYwus=; b=S1Q/1DRWr/NRJEAi2OtCShL8GCryQxbdDUZ5eBsLS6RKrqTv6osZeplq4vzgj+e5Tl34Bi /pwh0y1iP+Lx1OXrqAKZdKyTGfRvMi+X7hrh5LfTCvJsX4WhZVeWKyHIOeIl+F742t3IPc UuKp8uA/9WiGLsDEtWl859PXkjU8xds= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-306-uIXwTZ5OO42nv2qg208mSw-1; Sat, 03 Dec 2022 20:31:20 -0500 X-MC-Unique: uIXwTZ5OO42nv2qg208mSw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 446C429ABA17; Sun, 4 Dec 2022 01:31:20 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-31.pek2.redhat.com [10.72.12.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E3D4141511E; Sun, 4 Dec 2022 01:31:15 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, stephen.s.brennan@oracle.com, urezki@gmail.com, willy@infradead.org, akpm@linux-foundation.org, hch@infradead.org, Baoquan He Subject: [PATCH v1 4/7] mm/vmalloc: explicitly identify vm_map_ram area when shown in /proc/vmcoreinfo Date: Sun, 4 Dec 2022 09:30:43 +0800 Message-Id: <20221204013046.154960-5-bhe@redhat.com> In-Reply-To: <20221204013046.154960-1-bhe@redhat.com> References: <20221204013046.154960-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spamd-Result: default: False [-1.81 / 9.00]; BAYES_HAM(-5.41)[98.72%]; R_MISSING_CHARSET(2.50)[]; MID_CONTAINS_FROM(1.00)[]; SUBJECT_HAS_UNDERSCORES(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[redhat.com,none]; R_DKIM_ALLOW(-0.20)[redhat.com:s=mimecast20190719]; R_SPF_ALLOW(-0.20)[+ip4:170.10.133.0/24]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; RCPT_COUNT_SEVEN(0.00)[8]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[redhat.com:+]; RCVD_COUNT_THREE(0.00)[4]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_SOME(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: D3230120008 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: w5jwjspshnr3nh5dii9i7hxiuiak9tqu X-HE-Tag: 1670117486-716896 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: Now, by marking VMAP_RAM in vmap_area->flags for vm_map_ram area, we can clearly differentiate it with other vmalloc areas. So in s_show(), change the ambiguous checking 'if (!va->vm) to clear "if (!va->vm && (va->flags & VMAP_RAM))". This let's picks out vm_map_ram area, and avoids the being unmapped normal vmalloc area to be mistakenly recognized as vm_map_ram area. Meanwhile, the code comment above vm_map_ram area checking in s_show() is not needed any more, remove it here. Signed-off-by: Baoquan He --- mm/vmalloc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index e6b46da3e044..3c60026fb162 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -4181,11 +4181,7 @@ static int s_show(struct seq_file *m, void *p) va = list_entry(p, struct vmap_area, list); - /* - * s_show can encounter race with remove_vm_area, !vm on behalf - * of vmap area is being tear down or vm_map_ram allocation. - */ - if (!va->vm) { + if (!va->vm && (va->flags & VMAP_RAM)) { seq_printf(m, "0x%pK-0x%pK %7ld vm_map_ram\n", (void *)va->va_start, (void *)va->va_end, va->va_end - va->va_start);