From patchwork Mon Feb 6 08:40:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 53078 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2121942wrn; Mon, 6 Feb 2023 00:44:39 -0800 (PST) X-Google-Smtp-Source: AK7set+PugZ308CR3ypB7VGe1UO4bvDjr/HWh/UqUmp3xJ1hS7OnuaZQUVE5bcwWMwbcJu/krd5O X-Received: by 2002:a05:6a21:150d:b0:bc:96bd:d701 with SMTP id nq13-20020a056a21150d00b000bc96bdd701mr22701223pzb.13.1675673079526; Mon, 06 Feb 2023 00:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675673079; cv=none; d=google.com; s=arc-20160816; b=TzyfXp9OW8uzeJDR3iUfCJMkzGSfbBCpySpzWS2wVLnyRylsESCmOV+zvQnNVl9R/Y QcH4KCpawOMoVdcqS5DqTOH9EFnLs1AZv2tyL6SCgdirkIB5TeD6Hr+1ymAhRBvNKdmn wR6SXUEmAF6WV0RdzfIVhmBuG99/QG/0h1sRZy2Cf+LpGqWaWzzCSo6ETkwsy3AkTXFR 0wZXmWMfNZ5pEHGfByzBD60ElwY4FLVJD1yrj2Zi4TXSb/txq7utvI7qBXAefYDZN+lZ vo8S5DJNMOg6I4v6DZvfRjVXCBUH2HuogSJqY58FzeDaX4z+Of3AX/p5miNMuObAFPjh Ox2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sogBXQhtIR7vZucKmKsbqW5MbruC+cj6YTx4qBV1xD0=; b=mqgIkF9nGR/Xg1siZ+lcgdSP8M8kvAOusMb0tvhDhG3AvE8hxsO2Jzb1hk5hTYaSfv tL0qkyv32MF/UlCfwdur+KUHAd6lasBjDzbbHG2O+0MMtHNQ1j14S79qgCzRy8ZIwuq8 /UM0/xO/IvvVlHawmFUFdnAgrJRRxbi7uqu+cZE2I1ewNg4XlKHpGUh1BScikuNN/OXR s7pJzUYR4LzAryW/7wh16cKMY+b5kfUClcLVYc4zW006AiphGQBhTIwqZVKSM1AXrK0m bg9Dc1bl4rrgrZhoX3UhDkPI3QomIwOQP42Vcu7qtWE9XJq7YZKbc5Ss9g377mlpRIAC aZBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BayCutNN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a17090ac40600b002300816bbefsi11640750pjt.68.2023.02.06.00.44.25; Mon, 06 Feb 2023 00:44:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BayCutNN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbjBFIls (ORCPT + 99 others); Mon, 6 Feb 2023 03:41:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjBFIlh (ORCPT ); Mon, 6 Feb 2023 03:41:37 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E88B18160 for ; Mon, 6 Feb 2023 00:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675672850; 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=sogBXQhtIR7vZucKmKsbqW5MbruC+cj6YTx4qBV1xD0=; b=BayCutNNAaQn2i7aCQpY5iHEDjg1CYaf0ge3n6bh5blTeSJgo53psy/rGF6Gju5QZzJB5A VjdxNmUZT7mbZFyCYWV/CcVtot6OJjAhy4/BILzMU0zf/q0huQteM4K/9zS9mEZ6tjMqRf t9AeKjU14x2j3BO7mWc7L676B3IfEXo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-T_gvIW3LMJm5jXCXZZ71cw-1; Mon, 06 Feb 2023 03:40:47 -0500 X-MC-Unique: T_gvIW3LMJm5jXCXZZ71cw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 28E7D80D0ED; Mon, 6 Feb 2023 08:40:47 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-71.pek2.redhat.com [10.72.12.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0267E2166B2A; Mon, 6 Feb 2023 08:40:42 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, stephen.s.brennan@oracle.com, urezki@gmail.com, lstoakes@gmail.com, error27@gmail.com, Baoquan He Subject: [PATCH v5 4/7] mm/vmalloc: explicitly identify vm_map_ram area when shown in /proc/vmcoreinfo Date: Mon, 6 Feb 2023 16:40:17 +0800 Message-Id: <20230206084020.174506-5-bhe@redhat.com> In-Reply-To: <20230206084020.174506-1-bhe@redhat.com> References: <20230206084020.174506-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757070575070362790?= X-GMAIL-MSGID: =?utf-8?q?1757070575070362790?= Now, by marking VMAP_RAM in vmap_area->flags for vm_map_ram area, we can clearly differentiate it with other vmalloc areas. So identify vm_map_area area by checking VMAP_RAM of vmap_area->flags when shown in /proc/vmcoreinfo. 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 Reviewed-by: Lorenzo Stoakes --- mm/vmalloc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 4bb78ebd70f6..dea76e73e57c 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -4233,14 +4233,11 @@ 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) { - 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); + if (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); goto final; }