Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4167248pxu; Wed, 9 Dec 2020 09:57:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxJcKFegoBwpvIIH6gwNdDxMPotBhzb22CJcOCJ0ah2lXFbHVFBld6mQ0OeG9bjNF2Dp2K X-Received: by 2002:aa7:c94b:: with SMTP id h11mr3063853edt.322.1607536647231; Wed, 09 Dec 2020 09:57:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607536647; cv=none; d=google.com; s=arc-20160816; b=JqKG0wcip+aBLC/ctWCPO3dfjWCYetav7b+TtV9HOFWXoo7tYZY9LGVpZtQVFCLPQZ PYvBSnSW1wvEJZAOFJzWhEoYVZfsQdMp3mT6p2aYIUIT4A4GXQAlc38oe8JJ8cjwCidl 0c4gSdyfEc5+jwz7C98YbX2jNbPRF3WpLLQA0dAfxIHsBX1Udjd8rnqBV0d7Sda65JA1 BkPoQqGLoWQ6V8e2lzV7cGa3b3SfPtyL9hvv4u6/3sZBdkFGoEV2z7fw6485VbIByZT0 OOkGoeKRVC4U0koab6YCBTXxQTnGEDo1i7GSGdSWxHFxTURqO2oYwe2eYKofoqeeVByB o3Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=HZZvOi2M6BvlXHa8T+1T4pO6dXKOTt9mC9p59ymcSZ4=; b=WInD/ORJT7NOXyhpoIp8gedTylMUPfA426W1lIMYACzUhqRjwhOxrYi6APgzgq2U+T la8OzIDHULnswaXJOElC7IEQrW8GFA/uHW3U4uTxbtlLr/fHiXJPJtEhw723vN8T0yTz KpJq1juuu/hLlHSizfoHXoDSMDtOcBTpXd1KX4dBYiOeoVuWsdRSRmLEReTnHQNPXmiJ XUS7CBpaAyoO0MnbU5HPqmZNxSAYHCNqkA+nBQ8MHoyh6U+AEYzbTEPMHTdX9Pd4W9Ta 2kDSgqa0V01QnnmoqMpiBiE58exfQ7F0CzzCE2QFkpEIT0DdtVzU/RMWq7G8ysDNXnDn 1Exw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si1247709edo.164.2020.12.09.09.57.03; Wed, 09 Dec 2020 09:57:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729122AbgLIRwE (ORCPT + 99 others); Wed, 9 Dec 2020 12:52:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:59520 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726449AbgLIRwD (ORCPT ); Wed, 9 Dec 2020 12:52:03 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DD245AD3F; Wed, 9 Dec 2020 17:51:20 +0000 (UTC) Subject: Re: [PATCH v2 sl-b 3/5] mm: Make mem_dump_obj() handle vmalloc() memory To: paulmck@kernel.org, rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, mingo@kernel.org, jiangshanlai@gmail.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, iamjoonsoo.kim@lge.com, andrii@kernel.org, linux-mm@kvack.org References: <20201209011124.GA31164@paulmck-ThinkPad-P72> <20201209011303.32737-3-paulmck@kernel.org> From: Vlastimil Babka Message-ID: <1c25ca09-ec43-df31-a5ba-476397637a53@suse.cz> Date: Wed, 9 Dec 2020 18:51:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20201209011303.32737-3-paulmck@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/9/20 2:13 AM, paulmck@kernel.org wrote: > From: "Paul E. McKenney" > > This commit adds vmalloc() support to mem_dump_obj(). Note that the > vmalloc_dump_obj() function combines the checking and dumping, in > contrast with the split between kmem_valid_obj() and kmem_dump_obj(). > The reason for the difference is that the checking in the vmalloc() > case involves acquiring a global lock, and redundant acquisitions of > global locks should be avoided, even on not-so-fast paths. > > Note that this change causes on-stack variables to be reported as > vmalloc() storage from kernel_clone() or similar, depending on the degree > of inlining that your compiler does. This is likely more helpful than > the earlier "non-paged (local) memory". > > Cc: Andrew Morton > Cc: Joonsoo Kim > Cc: > Reported-by: Andrii Nakryiko > Signed-off-by: Paul E. McKenney ... > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -3431,6 +3431,18 @@ void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms) > } > #endif /* CONFIG_SMP */ > > +bool vmalloc_dump_obj(void *object) > +{ > + struct vm_struct *vm; > + void *objp = (void *)PAGE_ALIGN((unsigned long)object); > + > + vm = find_vm_area(objp); > + if (!vm) > + return false; > + pr_cont(" vmalloc allocated at %pS\n", vm->caller); Would it be useful to print the vm area boundaries too? > + return true; > +} > + > #ifdef CONFIG_PROC_FS > static void *s_start(struct seq_file *m, loff_t *pos) > __acquires(&vmap_purge_lock) >