From patchwork Wed Apr 10 10:28:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 10893631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E44A717E6 for ; Wed, 10 Apr 2019 11:05:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCE1C2869B for ; Wed, 10 Apr 2019 11:05:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C03B428A26; Wed, 10 Apr 2019 11:05:50 +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=-2.9 required=2.0 tests=BAYES_00,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 37F6C2869B for ; Wed, 10 Apr 2019 11:05:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E526A6B027A; Wed, 10 Apr 2019 07:05:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DDBBA6B027C; Wed, 10 Apr 2019 07:05:48 -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 CC9606B027D; Wed, 10 Apr 2019 07:05:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 84E616B027A for ; Wed, 10 Apr 2019 07:05:48 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id e6so1219272wrs.1 for ; Wed, 10 Apr 2019 04:05:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :user-agent:date:from:to:cc:subject:references:mime-version; bh=8bk9z1Ja4+T6AzhJsl417UlQDfrKqoRXML8B0kjTIwM=; b=kD0WazWmuJ3vem9Za81mo1NSb3PM48mwsU5hVJ1sfak+i3leC7733Vbz2Q2tF+Wy3U pQzj8LC2vm5CHYrb3AEQEskI70wdNBuxuF/CFDFarE6+L0xA0c2eqFLiht3DcMEbrOJJ k/j0E4rAn9LmstnQ2mBWqaiEawwtadNtBCiV5ovnyV5fAsIAH7dAn14V8sg1MUCMLxnq Ze8PAvVUsbO/8nzQZ+XCFXQu5bqHDLM3HDd3XMDqP/F4AUUbTlmZBJnPqrWDXBhXkQFP CE1IhfFslnYtrewcLqlsExkorqXdXlVVPSLh1defszvluWvrwRtYgz8EWOwtmWeMWKXM 3iKg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de X-Gm-Message-State: APjAAAXKsI7NtW6Vh+YcwTs8PJ6eCPlX0nrYn+nKSE1KX019kaMYFPXJ QNAYxSNkvbCFvWo7jgTEx1mjQ/LiYo4p5Lu0bqy698lqiNwo+qaAZkonMd1XquboYI72LM9vgp+ GkhAlAdg5fB8B3kix4Bpt7ui9/7mbm8v0GmwOu3/BzyQzX8z8lSTBSKicYBF08R+mAQ== X-Received: by 2002:a1c:f909:: with SMTP id x9mr2538488wmh.18.1554894347947; Wed, 10 Apr 2019 04:05:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZ3IcPSXbV7uzmIoLQhBXc7/knsJZrfhRvoIV0qJDCLHAk9zpVneoYQDfMCZRefigyItaI X-Received: by 2002:a1c:f909:: with SMTP id x9mr2538423wmh.18.1554894346978; Wed, 10 Apr 2019 04:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554894346; cv=none; d=google.com; s=arc-20160816; b=GeoFU1KIgTBii23EGi95/XMvWrN8wcPEPMD7ykJnvOq6eGxJRugGCIS96Q4LRm6O7F 6wOkb4FCXOqkMd6A9PFJ762UOgMZ52sW8IEIYM9um6XMhGhUeLOu+7YAj6APTX+CasR8 nk5Oepzs35xQAv/4xypd6FwEwobQNmaoobb7jT92doNT28cKbKkxu2SdyJcD5T4U2oWl Va8IR153s2AsbseReLp59Y+f152aH/yzjjzlKqwnY4ZMtf2eWA/l9+1oMYtcjTsJk32r cu7fXFA7MebeMfTi7uY/MojFyAzrWYOjLZk498nK+8Q8LjXEoTSMFDd4XNzZM86kUgQ9 FESQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:subject:cc:to:from:date:user-agent :message-id; bh=8bk9z1Ja4+T6AzhJsl417UlQDfrKqoRXML8B0kjTIwM=; b=HlFUaa0UwFZNodeyIgjdZnORgvg83OzC8BvlChdIUGwn7F70orlY1uoHdqVQGSWj/h lvvS2MZCR4pnmw8x8mADme6I9xYxcwAs9zr+sYW044WY+EfKcdk9VElO4C9V29l5RkrV ZJzCEkvPyRRDY9L49YvrhVevXN3pW7Y6iC2+sC5MbDECKMVqPlW2gJkgBGQ3g4yN4GeO 7r7/EQ+fhNS+7uRtytLKyAJhuF8vbvNmtltG9CxgmFMZNr0ZiRhupA4yxhHtidZHhYCw 5/ob2ouNfIviJsytI4OVlGk1mIB4ZJkZNYf3D3qlmDAsF9HPkeu/syAq27UiKuQiuNYv KiQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id y41si24697056wrd.189.2019.04.10.04.05.46 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 10 Apr 2019 04:05:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hEB2y-00053Y-7a; Wed, 10 Apr 2019 13:05:40 +0200 Message-Id: <20190410103644.574058244@linutronix.de> User-Agent: quilt/0.65 Date: Wed, 10 Apr 2019 12:28:05 +0200 From: Thomas Gleixner To: LKML Cc: Josh Poimboeuf , x86@kernel.org, Andy Lutomirski , Steven Rostedt , Alexander Potapenko , Andrew Morton , Pekka Enberg , linux-mm@kvack.org, David Rientjes , Christoph Lameter Subject: [RFC patch 11/41] mm/slub: Remove the ULONG_MAX stack trace hackery References: <20190410102754.387743324@linutronix.de> MIME-Version: 1.0 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 No architecture terminates the stack trace with ULONG_MAX anymore. Remove the cruft. While at it remove the pointless loop of clearing the stack array completely. It's sufficient to clear the last entry as the consumers break out on the first zeroed entry anyway. Signed-off-by: Thomas Gleixner Cc: Andrew Morton Cc: Pekka Enberg Cc: linux-mm@kvack.org Cc: David Rientjes Cc: Christoph Lameter --- mm/slub.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) --- a/mm/slub.c +++ b/mm/slub.c @@ -553,7 +553,6 @@ static void set_track(struct kmem_cache if (addr) { #ifdef CONFIG_STACKTRACE struct stack_trace trace; - int i; trace.nr_entries = 0; trace.max_entries = TRACK_ADDRS_COUNT; @@ -563,20 +562,16 @@ static void set_track(struct kmem_cache save_stack_trace(&trace); metadata_access_disable(); - /* See rant in lockdep.c */ - if (trace.nr_entries != 0 && - trace.entries[trace.nr_entries - 1] == ULONG_MAX) - trace.nr_entries--; - - for (i = trace.nr_entries; i < TRACK_ADDRS_COUNT; i++) - p->addrs[i] = 0; + if (trace.nr_entries < TRACK_ADDRS_COUNT) + p->addrs[trace.nr_entries] = 0; #endif p->addr = addr; p->cpu = smp_processor_id(); p->pid = current->pid; p->when = jiffies; - } else + } else { memset(p, 0, sizeof(struct track)); + } } static void init_tracking(struct kmem_cache *s, void *object) From patchwork Wed Apr 10 10:28:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 10893649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F281922 for ; Wed, 10 Apr 2019 11:06:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64A022869B for ; Wed, 10 Apr 2019 11:06:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58EC428A26; Wed, 10 Apr 2019 11:06:17 +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=-2.9 required=2.0 tests=BAYES_00,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 EFE912869B for ; Wed, 10 Apr 2019 11:06:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52E6B6B0284; Wed, 10 Apr 2019 07:06:13 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4B91B6B0287; Wed, 10 Apr 2019 07:06:13 -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 2BBDB6B0288; Wed, 10 Apr 2019 07:06:13 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id D70226B0284 for ; Wed, 10 Apr 2019 07:06:12 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id z9so1185064wrn.21 for ; Wed, 10 Apr 2019 04:06:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :user-agent:date:from:to:cc:subject:references:mime-version; bh=hgUYKLZli5yphNqQuanQ8lMvCN3LTjThq/hkCT3u9OU=; b=Saom9QY9u2aitX3lWvB0QuQGGW+vakV6tKU5oy83Tko3E5YTkUEnaFpivYNVUnn7+B LkptNV2m617kAM9XG0HevQjy0bbYvZ5djFfk3i5eKc/Q0BbWtcyj5+KffdxrzqwncdY5 YsU19uQkJsTlJMzvUUoPw7h7y0ReBC5mGDKvz6CU+PDqkMn+qjAcNFY0B6Tyb/oCK9XH 2Coehw0VG05vZThxD175acaH3jm8rssg3t145EBozIJv4RXKKpkNGD/1RjMDNq+84uKc PCyAsUUB7jNJD5u9hpdQe3iZQ14fXNFf+f3HpJUOJsxHCGHWJMhES6z2ZbZ4gIuLgyoQ Av4Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de X-Gm-Message-State: APjAAAXPVlvYDgizuuNAZEAC5X4VSQP6dvPxV1mSxFAo6WpBO2tTbDQW p1UpkLqNtiqegJgZDcrv/OC49HGKxcgPsUS40bH2KSaT+8Ndku14HQ7e3iRls/C9GEna9UsjEI9 qnCUqaN57ZfigndAQw4+0CmSciKm/pcpRmHeuCu+nt18KNXV4yadNgnwz2gew0DwpuA== X-Received: by 2002:a05:6000:124a:: with SMTP id j10mr27975443wrx.24.1554894372428; Wed, 10 Apr 2019 04:06:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKSEbZNw85YEtn+3hA6ok9OtA+bD0d5+24W0DJoIoSuKZwSDTr9V9qwHKMma8f0VyGBwj7 X-Received: by 2002:a05:6000:124a:: with SMTP id j10mr27975397wrx.24.1554894371731; Wed, 10 Apr 2019 04:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554894371; cv=none; d=google.com; s=arc-20160816; b=fjNLcw5JQMYQFqYRKj4eTxHJrxDpS7hSNBiz1yWDY/7CzY/2SEh8f9tbmkhTLo5Q2/ +cxkBD8IZ+wwL57xjjQIAcOGTKisAWGZ6Z++63hPl2HB9scoKqdnSw/L9WG3Iq3W+VfC pb1DRcqb7Ar4p+iTC+QfATZ89ls0sH6Zaxxv5m2GVyB95ysfs5cgfPh3Xwfw2aHAhnwF pXKVhx2pKMnGKclnw0eiqvQpj2cRap4A8UPO0fC52CU0xnJxYu+rAYZ2U0AOD7IaNz/O UQAc2qdenFDiv1XEhM1XpvDvXJ/Io2QpwgR5xoMeUW7OMDPqeZW3oyN5cly4aQl1+BdP epfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:subject:cc:to:from:date:user-agent :message-id; bh=hgUYKLZli5yphNqQuanQ8lMvCN3LTjThq/hkCT3u9OU=; b=cQbAtazPQmoUuPEY49FLVDXP183Sazi/99j2qcQVVkdGtEUTZlQrFZ86pU8Wxcn8yo u3rgv+N7l7ZMBDnjLDT0w73mpovTJ64Ynd694PIX44utZUYJvhtA8iXf2lcpx9ojJmY3 aAByt+z+jNhPCxS0PT5Id41XChhriueaqGEhFfyyeT4i+YtE3dHQALkvMN3CXwoDu3de q7/XITMGffZcoLveFX3nmVUT96XO2zsrMHQZBkBQGoe/8+hDE65zl9ZBsOgg2WfdwkXM AVSv62SppGyV2v9c7h7ncu3Ypy0d94hDX11pEZHP6PY7tpEaBgemdKUVXqWDWnKnPseU EhZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id x5si18109793wrd.204.2019.04.10.04.06.11 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 10 Apr 2019 04:06:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hEB2z-00054D-Jd; Wed, 10 Apr 2019 13:05:41 +0200 Message-Id: <20190410103644.661974663@linutronix.de> User-Agent: quilt/0.65 Date: Wed, 10 Apr 2019 12:28:06 +0200 From: Thomas Gleixner To: LKML Cc: Josh Poimboeuf , x86@kernel.org, Andy Lutomirski , Steven Rostedt , Alexander Potapenko , Michal Hocko , linux-mm@kvack.org, Mike Rapoport , Andrew Morton Subject: [RFC patch 12/41] mm/page_owner: Remove the ULONG_MAX stack trace hackery References: <20190410102754.387743324@linutronix.de> MIME-Version: 1.0 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 No architecture terminates the stack trace with ULONG_MAX anymore. Remove the cruft. Signed-off-by: Thomas Gleixner Cc: Michal Hocko Cc: linux-mm@kvack.org Cc: Mike Rapoport Cc: Andrew Morton --- mm/page_owner.c | 3 --- 1 file changed, 3 deletions(-) --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -148,9 +148,6 @@ static noinline depot_stack_handle_t sav depot_stack_handle_t handle; save_stack_trace(&trace); - if (trace.nr_entries != 0 && - trace.entries[trace.nr_entries-1] == ULONG_MAX) - trace.nr_entries--; /* * We need to check recursion here because our request to stackdepot From patchwork Wed Apr 10 10:28:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 10893633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2395922 for ; Wed, 10 Apr 2019 11:05:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABEC92869B for ; Wed, 10 Apr 2019 11:05:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FC8828A26; Wed, 10 Apr 2019 11:05:55 +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=-2.9 required=2.0 tests=BAYES_00,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 814DB2869B for ; Wed, 10 Apr 2019 11:05:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74B626B027D; Wed, 10 Apr 2019 07:05:53 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6AE5D6B027E; Wed, 10 Apr 2019 07:05:53 -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 5790D6B027F; Wed, 10 Apr 2019 07:05:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 1CE196B027D for ; Wed, 10 Apr 2019 07:05:53 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id n6so1213588wrm.2 for ; Wed, 10 Apr 2019 04:05:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :user-agent:date:from:to:cc:subject:references:mime-version; bh=LcmKUenQqDu1wL4NqSu9omBnmY3a5jcRvDfJiOhPcms=; b=lmNGTS6wTV+ZK/vugvqFrlQmNUSOwWqE5TZ/pSsV1H/cTFo1EeIsPdYVQvc4ciX64W XhFE5deNwEhXwYaiASa5wcY2ohSOyM7fPuvsP0qdYePkddF/R7XmJsIALLkg6Bv9ny+N uNlMyfP4vvUVZfPtvXffVZQcYyRrnoIop7H9nleJkB2MBK+e0fm1hlJDKRE8anUL+KtI o54uxTtgSCK8R2sF51EPY0MXVqhwAeRs/1AVoLnqhL8mkDt8tDToy36jfXWWrzrx4tou bx3P1lUWUTXOmSepc7Txugzaig6HCFU68jKHN7yBKwSXMa3p7x2nQwSvTW2qmhzt1+6d lrjQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de X-Gm-Message-State: APjAAAWsOcO0lHlIk+Q4h7Tta54K3kO8ZH7ewevpJ+Vb0jFo7afAzVhd CilM4w6d7r2dn8P3nXkR+LTWkE1ugq5uxSM26oQvq4QcCXzerQ3uvxLt0VErvMn3BfwI5QgTCdf KzUg4eSc3f1RuAeoBSCwZshlEE90IxKVHPBON78IQ2eaVXlg617KORUzj6JfDmMhHUg== X-Received: by 2002:a1c:c504:: with SMTP id v4mr2487089wmf.45.1554894352669; Wed, 10 Apr 2019 04:05:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBVz4D/zQnRqhy7GHrcF6wvvDwXUwPlIGxRn8c6I3g3uRGh2jFgP2p/8a/t37IxvpH3kpe X-Received: by 2002:a1c:c504:: with SMTP id v4mr2487025wmf.45.1554894351734; Wed, 10 Apr 2019 04:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554894351; cv=none; d=google.com; s=arc-20160816; b=ib+DIBfcAllOT0fc7ab7ti5pr0fWx2DeMiZOtl1flJwKnswVG2AbdvYSUzNAZewykn IEDHFJ2BreG+tAkdPrGNJmUNaN5wnBW4nKWJkI473/fxZAY6iISVCWp8Dequ4YS6J2Hl tiZiXOr8c1PobHQYm9JYI51h9gzYN4Rjwqq+CkHGBbjx60VHzEV7Ksy3B+cuSx95qOmC bpe6DNVtoKp9q5jU6HcSjdbnfhBTmDd9gdWusbdFa7dwhFcEWdh4qubmZOYObkYOr4P5 pudPbbDBvilKFuhBwxpI8ulimLYfjxYWuSBmYvb5gVhKc12we0k6kohUjKHCz19CH/Df HvVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:subject:cc:to:from:date:user-agent :message-id; bh=LcmKUenQqDu1wL4NqSu9omBnmY3a5jcRvDfJiOhPcms=; b=AKLNCXx+qV6HmUYLSjequ6lS+jc5QInx0VvOE61X/hIYQTf1IWOV2KZiih5CydfzfC 5Aq/p+oJ2UnuDCM4m8r+0Krudf/bFU20dIsVr67/8JhlDXDBELEa9hrK7cQZWthfQTqn Av0yPctu8cSCrd+ClYXZ69PqeotbpBidhJd4WJDuf6Hp4k5HlKrnDgYav3UI6B89GsUk BbuP3ua1/mlG8SD75/aOJKFetBOOdTkST+kBOULIPRmXEkWlCAfD7bHpq6PSWHVQeNQa eVvAXuRNBaZnGZtRRUj7kv44MWv1ROPHAEpU+wusSQPIlDhpydLhF9IjcU8EECqPBXfd dEVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id 67si1224663wma.59.2019.04.10.04.05.51 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 10 Apr 2019 04:05:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hEB31-00054r-7s; Wed, 10 Apr 2019 13:05:43 +0200 Message-Id: <20190410103644.750219625@linutronix.de> User-Agent: quilt/0.65 Date: Wed, 10 Apr 2019 12:28:07 +0200 From: Thomas Gleixner To: LKML Cc: Josh Poimboeuf , x86@kernel.org, Andy Lutomirski , Steven Rostedt , Alexander Potapenko , Andrey Ryabinin , kasan-dev@googlegroups.com, Dmitry Vyukov , linux-mm@kvack.org Subject: [RFC patch 13/41] mm/kasan: Remove the ULONG_MAX stack trace hackery References: <20190410102754.387743324@linutronix.de> MIME-Version: 1.0 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 No architecture terminates the stack trace with ULONG_MAX anymore. Remove the cruft. Signed-off-by: Thomas Gleixner Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: kasan-dev@googlegroups.com Cc: Dmitry Vyukov Cc: linux-mm@kvack.org Acked-by: Dmitry Vyukov --- mm/kasan/common.c | 3 --- 1 file changed, 3 deletions(-) --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -74,9 +74,6 @@ static inline depot_stack_handle_t save_ save_stack_trace(&trace); filter_irq_stacks(&trace); - if (trace.nr_entries != 0 && - trace.entries[trace.nr_entries-1] == ULONG_MAX) - trace.nr_entries--; return depot_save_stack(&trace, flags); } From patchwork Wed Apr 10 10:28:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 10893639 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C1A817E6 for ; Wed, 10 Apr 2019 11:06:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5536528A26 for ; Wed, 10 Apr 2019 11:06:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 492DF28A28; Wed, 10 Apr 2019 11:06:05 +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=-2.9 required=2.0 tests=BAYES_00,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 B8E3B28A26 for ; Wed, 10 Apr 2019 11:06:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA81F6B027F; Wed, 10 Apr 2019 07:06:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A30E36B0280; Wed, 10 Apr 2019 07:06:03 -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 924F06B0281; Wed, 10 Apr 2019 07:06:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by kanga.kvack.org (Postfix) with ESMTP id 55CCF6B027F for ; Wed, 10 Apr 2019 07:06:03 -0400 (EDT) Received: by mail-wr1-f71.google.com with SMTP id e14so1182150wrt.18 for ; Wed, 10 Apr 2019 04:06:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :user-agent:date:from:to:cc:subject:references:mime-version; bh=1U2G8OZpL9WLxLD/CbZynvM0j6qReqT7BO3rwF09hao=; b=DxMmhPiilF0MI/ocFLBJXuplJCUKeQ8IS1VOKzDkzA2Ah7gxMJpKvkX8fRx8bWgCuY WAlwNxo9UxrSBOdqPAEwRaCRzJYrXuvgwLR1dvDxg/LTy5xZYMRUWvrk2S6sh+Zbf9VZ zWKFsaOITRSraWvL8mnB+GoJJTpA3rEjRhE3hFDP7M8x+5eOky2UT1qDzDkeGPIfAJrU xkEFUvVkBdTGHA5cBXoEWmoXH93i5j0uTBvA0JNDEg4z/Hxij0hboSV1A4CPgbCcxaGq P8zodsLLxi8aT3dSaSTdMm9nkLF/UZK87o9uX1m05eVHubTRRpD/LLIQVq47yRrKzlPe Mlmw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de X-Gm-Message-State: APjAAAXxasiNuWLtFFiLTzGCCeVYj/5LhvqQ6rzO3bm/18X3MqC4t/qW f2jvJ9xnaWb5GaThFCqbkOg8dYe9EEei1e1qXNVwsAlA4lrlqYbusyV6F7Nl5L4IdSK6k2Q2gim P4kXzAttDqMPUVeuCaN5pkgWP3CFSABNmTg0TRCRgTqjV08qZa/5KHCTs4Gsh1NDq+A== X-Received: by 2002:adf:b612:: with SMTP id f18mr15572372wre.236.1554894362849; Wed, 10 Apr 2019 04:06:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGPgSXiaIot/FOudZ6VLsf/ef3XUkbfUavQKhDBOTBnJdYXieRJ9QRF3s1GhKSuPa/2hit X-Received: by 2002:adf:b612:: with SMTP id f18mr15572323wre.236.1554894362103; Wed, 10 Apr 2019 04:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554894362; cv=none; d=google.com; s=arc-20160816; b=FWF/ro18sYZ+Hq0kPrHAvqfumv0niwFfG79JGz4fdi2HLk/u6CDVf9hk27P+f6ic8+ C7KjjzxVKFfhrsBxuh0GrqKmKmywxJqgApmZt3GNG6x26/u6GbLMOoSw3V1CpWHd0LfY GK4sR/np3EnX0SavLyPMlalqytEHH+D6NtUCm0J2xZ6evcxzpl93uP0ODO/hbn3Q2F2X VnrNGErIBHwx4Pp0RbI18qfCQmS+RH/n92MR08JhKq1n7yVqlJ6cR/C9zz3dpAZJO7w0 hX2lIAkvUPLOjnJ6F5ixHIapXVhf7AI0xzHjP1m7IsIq1TeT9ClqZFG9gSD/GdCCPitO fb3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:subject:cc:to:from:date:user-agent :message-id; bh=1U2G8OZpL9WLxLD/CbZynvM0j6qReqT7BO3rwF09hao=; b=oMCvgmh6rtfTQkytr5/uog1JvreA7QurpVIl1daDidNhe1bgT71bCq52DJa44TKIYw NpBC+i69SiPKzcK9cJbfP3LBYl1Ql/AAdcYYHMhgW1rPLGH9XB6hm1mY1NgBgQmt3Bx2 3gFeln7pK025qDGbN2zPMjeii1NGPogilBJ9lSySeqTni/pr2pU8nvU4dRrfEU+uACt2 jOS4jqzrTvhiQ5dzx7OjwIFb+RjfmYLiESO7koxXFFdLMHYI7weXs+aaZ4UZZigtOZmW ZJpZpSQhL8o/Be3n/iJ8F8EYUl76pXMDioAdFodgRp3d2+UbVdsnqbTipe8+OcuwvUoL hvHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id j46si23048130wre.143.2019.04.10.04.06.01 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 10 Apr 2019 04:06:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hEB3E-000590-JT; Wed, 10 Apr 2019 13:05:56 +0200 Message-Id: <20190410103645.685114415@linutronix.de> User-Agent: quilt/0.65 Date: Wed, 10 Apr 2019 12:28:17 +0200 From: Thomas Gleixner To: LKML Cc: Josh Poimboeuf , x86@kernel.org, Andy Lutomirski , Steven Rostedt , Alexander Potapenko , Andrew Morton , Pekka Enberg , linux-mm@kvack.org, David Rientjes , Christoph Lameter Subject: [RFC patch 23/41] mm/slub: Simplify stack trace retrieval References: <20190410102754.387743324@linutronix.de> MIME-Version: 1.0 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 Replace the indirection through struct stack_trace with an invocation of the storage array based interface. Signed-off-by: Thomas Gleixner Cc: Andrew Morton Cc: Pekka Enberg Cc: linux-mm@kvack.org Cc: David Rientjes Cc: Christoph Lameter --- mm/slub.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) --- a/mm/slub.c +++ b/mm/slub.c @@ -552,18 +552,14 @@ static void set_track(struct kmem_cache if (addr) { #ifdef CONFIG_STACKTRACE - struct stack_trace trace; + unsigned int nent; - trace.nr_entries = 0; - trace.max_entries = TRACK_ADDRS_COUNT; - trace.entries = p->addrs; - trace.skip = 3; metadata_access_enable(); - save_stack_trace(&trace); + nent = stack_trace_save(p->addrs, TRACK_ADDRS_COUNT, 3); metadata_access_disable(); - if (trace.nr_entries < TRACK_ADDRS_COUNT) - p->addrs[trace.nr_entries] = 0; + if (nent < TRACK_ADDRS_COUNT) + p->addrs[nent] = 0; #endif p->addr = addr; p->cpu = smp_processor_id(); From patchwork Wed Apr 10 10:28:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 10893641 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09EB917E6 for ; Wed, 10 Apr 2019 11:06:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E48B928A24 for ; Wed, 10 Apr 2019 11:06:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D879928A2A; Wed, 10 Apr 2019 11:06:09 +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=-2.9 required=2.0 tests=BAYES_00,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 762C028A24 for ; Wed, 10 Apr 2019 11:06:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 700C16B0281; Wed, 10 Apr 2019 07:06:08 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6879C6B0283; Wed, 10 Apr 2019 07:06:08 -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 541746B0284; Wed, 10 Apr 2019 07:06:08 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by kanga.kvack.org (Postfix) with ESMTP id 028B66B0281 for ; Wed, 10 Apr 2019 07:06:08 -0400 (EDT) Received: by mail-wr1-f69.google.com with SMTP id b16so1199153wrq.10 for ; Wed, 10 Apr 2019 04:06:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :user-agent:date:from:to:cc:subject:references:mime-version; bh=vE/h4iTaYWv2pX1V6FXNHaP6c7n1dI5SFaeY9qpaUbU=; b=dlNZVmWOldxpOhI9HRyQiQGneLgXEM+e07kPWFUO4Br3qv6Gdi7tTEUof1kNLmHckC YIuXFLU01I6PytYZSTPA4tF6YiXuFTvsyX/9XFNZOXoSB2zYLbANTSBiU8RFjT7xEShE evWLUWv+QxsM2FCaa3OqTjdRgUH7C3zgmmUKi6GN4C5kTTQIo3kDHIX21RCdNlSAA08N 98au5vilL9AbE3bUYyZz+t49Xf+sEiWKT4XE2ib8/pqiuP3q5sPOjEwB0DUBDjCk9fbl VABe236RSaOHZLEGqYMl0sn2d7QOpHR5Qn9vId5fTJbwQQIRz2xgjFEAGfFdzg3qWwhJ 2d4A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de X-Gm-Message-State: APjAAAWqCseqvMuTHG+xDp3EWjZqfgqU1vfHT4RW/MWQF3jd6Nv1aydu jtoPDXmc+I9TXESCzkp61t1PNgC7b8gaSThdTb/JAahIdhrY71EZeddjSF3s2TRnGzgqUvLvYG6 Em/X/KzW4SH2AnLxw8jQ+2Rw5NW7PVxiT6Cmw0jeEd17XvpT4XZAu3EtWV7g2ebRQZw== X-Received: by 2002:adf:b682:: with SMTP id j2mr26539235wre.3.1554894367534; Wed, 10 Apr 2019 04:06:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGz+Hwf+jrFzne/SU7o1727N7cW1Djv+Y1JinQhzZtD9PI0ooZCLq8mj/J1nNpqR1AmHIc X-Received: by 2002:adf:b682:: with SMTP id j2mr26539141wre.3.1554894366297; Wed, 10 Apr 2019 04:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554894366; cv=none; d=google.com; s=arc-20160816; b=fzavHkbLqJaYausELyWTwZKqbIhLsBP7sOT13DmUAETzf0xL9h7LQEs9TVe0UYRoiz QkBOVSiE/aubdY9OdQGuRGmy4ZKure5Cl8gUjunl/pMoCM2Pg/jXu/MqGBxxFfXUiFKp iLSQ6xFcwF0JWUOlbrbTrGeF16R9FDLoudExPkLcmNoplUFYxVdOkiI26fH7eWSsIC00 ypeyPY6J71hIyd+vEe5zxBuBSwv7EV2xnuyVT08Czvb6mGuKsUZtE7wZvy5Pqwrm088h 1tRhXLgsbrMwKkovdSQuRayRFL4A6FmoivccMwDfN6eq7s9bto/QD7wDYEJ+KqD/3kJl 9uKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:subject:cc:to:from:date:user-agent :message-id; bh=vE/h4iTaYWv2pX1V6FXNHaP6c7n1dI5SFaeY9qpaUbU=; b=RTCmgMyr+7WchBXPpTwpAXKesrbyaWkcMbPF94YjlxcGCGc5gAP1zb1LJOJOPVSWh5 LXEKmI0Q+s7Z2T4HyNijY1aXFPYnlSE2TONswPceePD08PufUJ6UjRh2hIdKeXiok9j2 kYAGzzoKJ6493/0f2bdnwzpuG+HJsxxDGC0xKfAWHCcJuyKJuhH6ebYr1j30APUS70Xo nmjuEY05quz26otBYGu18G5NpSoCAUJ1i5DqXi05gYaYV+B8E9RB8MgsnvNZnY93i+pN EX/8sK6J/VgvrKNwg6gRTx0dwX8x8YVPsmMv+AR8hor39SKdwqq+OrzkMb/th7j0tVFN vqEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id z1si23395478wrm.153.2019.04.10.04.06.06 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 10 Apr 2019 04:06:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hEB3G-00059b-0M; Wed, 10 Apr 2019 13:05:58 +0200 Message-Id: <20190410103645.774527030@linutronix.de> User-Agent: quilt/0.65 Date: Wed, 10 Apr 2019 12:28:18 +0200 From: Thomas Gleixner To: LKML Cc: Josh Poimboeuf , x86@kernel.org, Andy Lutomirski , Steven Rostedt , Alexander Potapenko , Catalin Marinas , linux-mm@kvack.org Subject: [RFC patch 24/41] mm/kmemleak: Simplify stacktrace handling References: <20190410102754.387743324@linutronix.de> MIME-Version: 1.0 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 Replace the indirection through struct stack_trace by using the storage array based interfaces. Signed-off-by: Thomas Gleixner Cc: Catalin Marinas Cc: linux-mm@kvack.org --- mm/kmemleak.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -410,11 +410,6 @@ static void print_unreferenced(struct se */ static void dump_object_info(struct kmemleak_object *object) { - struct stack_trace trace; - - trace.nr_entries = object->trace_len; - trace.entries = object->trace; - pr_notice("Object 0x%08lx (size %zu):\n", object->pointer, object->size); pr_notice(" comm \"%s\", pid %d, jiffies %lu\n", @@ -424,7 +419,7 @@ static void dump_object_info(struct kmem pr_notice(" flags = 0x%x\n", object->flags); pr_notice(" checksum = %u\n", object->checksum); pr_notice(" backtrace:\n"); - print_stack_trace(&trace, 4); + stack_trace_print(object->trace, object->trace_len, 4); } /* @@ -553,15 +548,7 @@ static struct kmemleak_object *find_and_ */ static int __save_stack_trace(unsigned long *trace) { - struct stack_trace stack_trace; - - stack_trace.max_entries = MAX_TRACE; - stack_trace.nr_entries = 0; - stack_trace.entries = trace; - stack_trace.skip = 2; - save_stack_trace(&stack_trace); - - return stack_trace.nr_entries; + return stack_trace_save(trace, MAX_TRACE, 2); } /* @@ -2019,13 +2006,8 @@ early_param("kmemleak", kmemleak_boot_co static void __init print_log_trace(struct early_log *log) { - struct stack_trace trace; - - trace.nr_entries = log->trace_len; - trace.entries = log->trace; - pr_notice("Early log backtrace:\n"); - print_stack_trace(&trace, 2); + stack_trace_print(log->trace, log->trace_len, 2); } /* From patchwork Wed Apr 10 10:28:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 10893647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36EDA17E6 for ; Wed, 10 Apr 2019 11:06:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B1F02869B for ; Wed, 10 Apr 2019 11:06:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EF6F28A26; Wed, 10 Apr 2019 11:06:15 +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=-2.9 required=2.0 tests=BAYES_00,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 914462869B for ; Wed, 10 Apr 2019 11:06:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C83996B0283; Wed, 10 Apr 2019 07:06:11 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BE1766B0284; Wed, 10 Apr 2019 07:06:11 -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 AA9226B0285; Wed, 10 Apr 2019 07:06:11 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by kanga.kvack.org (Postfix) with ESMTP id 5C4B76B0283 for ; Wed, 10 Apr 2019 07:06:11 -0400 (EDT) Received: by mail-wr1-f69.google.com with SMTP id t9so1189756wrs.16 for ; Wed, 10 Apr 2019 04:06:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :user-agent:date:from:to:cc:subject:references:mime-version; bh=hjDWrpdWylTsMo1MalcIFQCazEKgNe/cCDMg7s/oinM=; b=uNpWdt8akUOYS8wiUfh0nB0Rqe/+RqNftexSGNZyaNiPm+yM/dgVcr13kvI/cBSUq+ wE8fZL2mVerTxqiFlOClKs+bFbephpiw8/KwjXbIvmhwGrp3jQ5IUix+wUWuUQmjgUpa qSmmTxu8n8SlCeChMfYLzW4ohvhNTzrljHX1viP2OKpVNNaVaArUv7OMWHltMOXOrgrT c4ObJxqfK6kYnelBQizE8mD40vEyreHdoPfir/LBzS/+wQArVr7dLg4yFlBu22b/dd8J gG1UyRoSbkelnWZ31mIVYPJkwHYJxvshEOv4qJY+b9HHRJ3BNiuubfotFkmh7w8W8/iY fUZQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de X-Gm-Message-State: APjAAAUezrHexga4y/bUz50stNfzzAozBISKXA+CXYvnm6fDZjsHstaU S2zG2BJ/iuGoWAUvUyH1bxbHwusevcf6DJQfFZf6qSxWmDbpbgaLRFolFydCjk2duY78e2NsIim hK5SEGd3nFnX3nAoQ755ifu8V5yJR+kPXuRClqmOCfG+fYp+ly4hjzfFSOzV+p0A1yA== X-Received: by 2002:a5d:4751:: with SMTP id o17mr26809183wrs.121.1554894370886; Wed, 10 Apr 2019 04:06:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVUpLkX8WSTDYl3ah7z4e+Qq+v7TTWc4QKvOTYp7EHo0ic81YUHYmx3Z1J52/nH+3nmavE X-Received: by 2002:a5d:4751:: with SMTP id o17mr26809130wrs.121.1554894370075; Wed, 10 Apr 2019 04:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554894370; cv=none; d=google.com; s=arc-20160816; b=bnF9WssgTT1Km7tv+XBDi/m7ssvqMvKxN3Ux/IDJU9FucLN13s5LPPDpDoveA73NZx IkLc/qB5MNVu0pYrjk3Nkfqne7aU94nDPMFnwC/2oL8hhXYTkX0N85NP8xEY8dBBQ3dO FUcpql54XFBGWGOwhF/MGjVsAaLAkoWRxObZkqBgxWYAGh620pL2ftEri3fJGR1ouQgr gwWuPmmxLRFK8T4jQz22RTaxjCYVPwChnf+8P1HcMMHa4EakmPLKh6dWX7NpovecI00H GdUiTqeb6nubnUGDynTbfjV1tTR2Cu93/JmxNiS95fmB+6pGUE6lhK6dMn1tCht7tO1C gWzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:subject:cc:to:from:date:user-agent :message-id; bh=hjDWrpdWylTsMo1MalcIFQCazEKgNe/cCDMg7s/oinM=; b=VYA5LPvpaM0SvKLaNvTxcUWPkwbbrhJqKZcFVzHctFT0rAQM3CXITs2a2Q7rj+fuSn lvZd1DrdDMwZNv43J8Zy/acBR5+PuUjIC2rjm4qBCOKnwdCflnAyPuunSWlz/Qj0n9QW ta8uhdOlFJk4v1oeC3Jq4YouU+TQUsFDb0gu8Wxj/+UEGRpqbQRbHD4yd/CC8S+u51a2 2u/QXefm7sxJjWwCBeowZj/pI/ceOlFEZlvp8xvWTf+qj++RYHoJg9cbczm/w3VfCR+c Yw+7C3E/Sxig7y4r+umX4CFBHH1LhTVmYOPc6OkJ/AU6rPAy+DSa+CCGZcMhHCoNAQN6 Cugg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id b65si1299898wmd.167.2019.04.10.04.06.09 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 10 Apr 2019 04:06:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hEB3H-0005AD-H8; Wed, 10 Apr 2019 13:05:59 +0200 Message-Id: <20190410103645.862294081@linutronix.de> User-Agent: quilt/0.65 Date: Wed, 10 Apr 2019 12:28:19 +0200 From: Thomas Gleixner To: LKML Cc: Josh Poimboeuf , x86@kernel.org, Andy Lutomirski , Steven Rostedt , Alexander Potapenko , Andrey Ryabinin , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-mm@kvack.org Subject: [RFC patch 25/41] mm/kasan: Simplify stacktrace handling References: <20190410102754.387743324@linutronix.de> MIME-Version: 1.0 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 Replace the indirection through struct stack_trace by using the storage array based interfaces. Signed-off-by: Thomas Gleixner Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: kasan-dev@googlegroups.com Cc: linux-mm@kvack.org Acked-by: Dmitry Vyukov --- mm/kasan/common.c | 30 ++++++++++++------------------ mm/kasan/report.c | 7 ++++--- 2 files changed, 16 insertions(+), 21 deletions(-) --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -48,34 +48,28 @@ static inline int in_irqentry_text(unsig ptr < (unsigned long)&__softirqentry_text_end); } -static inline void filter_irq_stacks(struct stack_trace *trace) +static inline unsigned int filter_irq_stacks(unsigned long *entries, + unsigned int nr_entries) { - int i; + unsigned int i; - if (!trace->nr_entries) - return; - for (i = 0; i < trace->nr_entries; i++) - if (in_irqentry_text(trace->entries[i])) { + for (i = 0; i < nr_entries; i++) { + if (in_irqentry_text(entries[i])) { /* Include the irqentry function into the stack. */ - trace->nr_entries = i + 1; - break; + return i + 1; } + } + return nr_entries; } static inline depot_stack_handle_t save_stack(gfp_t flags) { unsigned long entries[KASAN_STACK_DEPTH]; - struct stack_trace trace = { - .nr_entries = 0, - .entries = entries, - .max_entries = KASAN_STACK_DEPTH, - .skip = 0 - }; + unsigned int nent; - save_stack_trace(&trace); - filter_irq_stacks(&trace); - - return depot_save_stack(&trace, flags); + nent = stack_trace_save(entries, ARRAY_SIZE(entries), 0); + nent = filter_irq_stacks(entries, nent); + return stack_depot_save(entries, nent, flags); } static inline void set_track(struct kasan_track *track, gfp_t flags) --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -100,10 +100,11 @@ static void print_track(struct kasan_tra { pr_err("%s by task %u:\n", prefix, track->pid); if (track->stack) { - struct stack_trace trace; + unsigned long *entries; + unsigned int nent; - depot_fetch_stack(track->stack, &trace); - print_stack_trace(&trace, 0); + nent = stack_depot_fetch(track->stack, &entries); + stack_trace_print(entries, nent, 0); } else { pr_err("(stack is not available)\n"); } From patchwork Wed Apr 10 10:28:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 10893645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C486017E6 for ; Wed, 10 Apr 2019 11:06:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB69C2869B for ; Wed, 10 Apr 2019 11:06:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FFB928A27; Wed, 10 Apr 2019 11:06:12 +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=-2.9 required=2.0 tests=BAYES_00,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 082372869B for ; Wed, 10 Apr 2019 11:06:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE0EE6B0282; Wed, 10 Apr 2019 07:06:08 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B69866B0283; Wed, 10 Apr 2019 07:06:08 -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 9E43F6B0284; Wed, 10 Apr 2019 07:06:08 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by kanga.kvack.org (Postfix) with ESMTP id 486466B0282 for ; Wed, 10 Apr 2019 07:06:08 -0400 (EDT) Received: by mail-wr1-f69.google.com with SMTP id u14so1206317wrr.9 for ; Wed, 10 Apr 2019 04:06:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:message-id :user-agent:date:from:to:cc:subject:references:mime-version; bh=4nz2/nz5lM3gNQrCI/sdcKPH5OkOjIS+6H6wEUVkeFU=; b=ZzQI3U8Ehm+S6bTtDz0tt35rSuMJoS+mlVxxYEXki+EHZT2hBQdhL8PRrTLVmVV7R1 pTQ5tW2Jaxn7c5K7lyVRzo3ACnWUNrqJCD1rH1E5mxb7hxSi3fW1EhjumW8kceC96Fbx hhhUuWCPujC3Ajinp9Ou5hjgQzZNogTVwAP65hqvrZgTwDAc7LgnubhRsvXZDCA9iFKX jhJ2umkqjtubRKb2fCxNN+RlCH+/FeKJ5HgkqLTocsRkomzC6pAY7OQ0+p8rbgU/pDVa YTQfGTBfmHnqFvjehGLyyEEF133Bvm0ZFoqexXHh6uDJuR7Pakl+m0UC8Lj1HMHoxCtj lNqA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de X-Gm-Message-State: APjAAAUOxShj1ZbvyZdnPdbNATS/NWWR+bIAQ17R0eKVv7Wf6fzeTWGf I5TnT+cINgBeK+sTJ51p4d182Myw3SgwBg6ViDmCBZ+heB47smpQjoKgTOQEBfJFlwawswPLliE /Gz3XOIIjLMZMQg/UmYtfPRHuwuDbkMBPr5ePBHCeMKvCifDqWJYsEjZHojTpb5tRAw== X-Received: by 2002:adf:fc47:: with SMTP id e7mr21864021wrs.100.1554894367793; Wed, 10 Apr 2019 04:06:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRf3dvGaFpZ2uNTae/WlE4nBlFet/1F0DcpSe8uFWhotqNYUUV9bLneWQIeOlYABB44giN X-Received: by 2002:adf:fc47:: with SMTP id e7mr21863943wrs.100.1554894366837; Wed, 10 Apr 2019 04:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554894366; cv=none; d=google.com; s=arc-20160816; b=dEXEewH5An7KfNPSNZBhJbEA34SZJkaCZldX+KqDlYzgE2qsZI+0UbGn0HcpnIeFFS Viqb3dlg/WSGjJ2xKObY1SDnOfdp2XlJVxaapwA5TJ8AdKWGNDAZ3RZyuiNQHQpqnAod AW+JIpZy35s3nd/sOQcH/1osz6PnByhtz1iRlLR1Gc359Ex0yuy2Mm/wgOWgVPTGGjO4 rSuyowO3g9QZdA5rsJnEjBATMoguBBPKpi2J8srel1mFafH+m8niiit1BPMzJPI5Bl95 hWv0R9TaOFjeLrj1UxsmEOAxWUpLoBESSEG5IXc1fY+x+6UJde3ktlGrueLFLYTKurHj i1EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:subject:cc:to:from:date:user-agent :message-id; bh=4nz2/nz5lM3gNQrCI/sdcKPH5OkOjIS+6H6wEUVkeFU=; b=tt78K493IV/zZ0yVK/o8y/y4aZA+WPyCMPbaFZBKmh5HfmOvueRJLR1eE349lYrO/Y VSjuzinqknf33QZBCdlYGimQH8jiQM0pzN6cT8QkqGP7GiTzRleFsobHq7a1/rSlfaYi Zd3I0lVHEdC+oCCQZ2LgUYJw9/b4aa6ncxVGqr2aRKLaqSVQkrn6YhYO+Rn/UsE3XyW9 70qOFANOchFxGeGmJAXm4G95WgqYy2YAiZBBqiOXYCEofIKc9CnDOtX/1IIxGKPq7bvj GPem8f0CxCi8nvixtabHihAS9XY4sZrBT3vjWDPJwq6d5+oys/qd5dHFW0Z8TnDvY8Ot eIcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id j5si1198746wme.179.2019.04.10.04.06.06 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 10 Apr 2019 04:06:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of tglx@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=tglx@linutronix.de Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hEB3J-0005Ae-7e; Wed, 10 Apr 2019 13:06:01 +0200 Message-Id: <20190410103645.951691679@linutronix.de> User-Agent: quilt/0.65 Date: Wed, 10 Apr 2019 12:28:20 +0200 From: Thomas Gleixner To: LKML Cc: Josh Poimboeuf , x86@kernel.org, Andy Lutomirski , Steven Rostedt , Alexander Potapenko , linux-mm@kvack.org, Mike Rapoport , David Rientjes , Andrew Morton Subject: [RFC patch 26/41] mm/page_owner: Simplify stack trace handling References: <20190410102754.387743324@linutronix.de> MIME-Version: 1.0 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 Replace the indirection through struct stack_trace by using the storage array based interfaces. The original code in all printing functions is really wrong. It allocates a storage array on stack which is unused because depot_fetch_stack() does not store anything in it. It overwrites the entries pointer in the stack_trace struct so it points to the depot storage. Signed-off-by: Thomas Gleixner Cc: linux-mm@kvack.org Cc: Mike Rapoport Cc: David Rientjes Cc: Andrew Morton --- mm/page_owner.c | 79 +++++++++++++++++++------------------------------------- 1 file changed, 28 insertions(+), 51 deletions(-) --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -58,15 +58,10 @@ static bool need_page_owner(void) static __always_inline depot_stack_handle_t create_dummy_stack(void) { unsigned long entries[4]; - struct stack_trace dummy; + unsigned int nent; - dummy.nr_entries = 0; - dummy.max_entries = ARRAY_SIZE(entries); - dummy.entries = &entries[0]; - dummy.skip = 0; - - save_stack_trace(&dummy); - return depot_save_stack(&dummy, GFP_KERNEL); + nent = stack_trace_save(entries, ARRAY_SIZE(entries), 0); + return stack_depot_save(entries, nent, GFP_KERNEL); } static noinline void register_dummy_stack(void) @@ -120,46 +115,39 @@ void __reset_page_owner(struct page *pag } } -static inline bool check_recursive_alloc(struct stack_trace *trace, - unsigned long ip) +static inline bool check_recursive_alloc(unsigned long *entries, + unsigned int nr_entries, + unsigned long ip) { - int i; + unsigned int i; - if (!trace->nr_entries) - return false; - - for (i = 0; i < trace->nr_entries; i++) { - if (trace->entries[i] == ip) + for (i = 0; i < nr_entries; i++) { + if (entries[i] == ip) return true; } - return false; } static noinline depot_stack_handle_t save_stack(gfp_t flags) { unsigned long entries[PAGE_OWNER_STACK_DEPTH]; - struct stack_trace trace = { - .nr_entries = 0, - .entries = entries, - .max_entries = PAGE_OWNER_STACK_DEPTH, - .skip = 2 - }; depot_stack_handle_t handle; + unsigned int nent; - save_stack_trace(&trace); + nent = stack_trace_save(entries, ARRAY_SIZE(entries), 2); /* - * We need to check recursion here because our request to stackdepot - * could trigger memory allocation to save new entry. New memory - * allocation would reach here and call depot_save_stack() again - * if we don't catch it. There is still not enough memory in stackdepot - * so it would try to allocate memory again and loop forever. + * We need to check recursion here because our request to + * stackdepot could trigger memory allocation to save new + * entry. New memory allocation would reach here and call + * stack_depot_save_entries() again if we don't catch it. There is + * still not enough memory in stackdepot so it would try to + * allocate memory again and loop forever. */ - if (check_recursive_alloc(&trace, _RET_IP_)) + if (check_recursive_alloc(entries, nent, _RET_IP_)) return dummy_handle; - handle = depot_save_stack(&trace, flags); + handle = stack_depot_save(entries, nent, flags); if (!handle) handle = failure_handle; @@ -337,16 +325,10 @@ print_page_owner(char __user *buf, size_ struct page *page, struct page_owner *page_owner, depot_stack_handle_t handle) { - int ret; - int pageblock_mt, page_mt; + int ret, pageblock_mt, page_mt; + unsigned long *entries; + unsigned int nent; char *kbuf; - unsigned long entries[PAGE_OWNER_STACK_DEPTH]; - struct stack_trace trace = { - .nr_entries = 0, - .entries = entries, - .max_entries = PAGE_OWNER_STACK_DEPTH, - .skip = 0 - }; count = min_t(size_t, count, PAGE_SIZE); kbuf = kmalloc(count, GFP_KERNEL); @@ -375,8 +357,8 @@ print_page_owner(char __user *buf, size_ if (ret >= count) goto err; - depot_fetch_stack(handle, &trace); - ret += snprint_stack_trace(kbuf + ret, count - ret, &trace, 0); + nent = stack_depot_fetch(handle, &entries); + ret += stack_trace_snprint(kbuf + ret, count - ret, entries, nent, 0); if (ret >= count) goto err; @@ -407,14 +389,9 @@ void __dump_page_owner(struct page *page { struct page_ext *page_ext = lookup_page_ext(page); struct page_owner *page_owner; - unsigned long entries[PAGE_OWNER_STACK_DEPTH]; - struct stack_trace trace = { - .nr_entries = 0, - .entries = entries, - .max_entries = PAGE_OWNER_STACK_DEPTH, - .skip = 0 - }; depot_stack_handle_t handle; + unsigned long *entries; + unsigned int nent; gfp_t gfp_mask; int mt; @@ -438,10 +415,10 @@ void __dump_page_owner(struct page *page return; } - depot_fetch_stack(handle, &trace); + nent = stack_depot_fetch(handle, &entries); pr_alert("page allocated via order %u, migratetype %s, gfp_mask %#x(%pGg)\n", page_owner->order, migratetype_names[mt], gfp_mask, &gfp_mask); - print_stack_trace(&trace, 0); + stack_trace_print(entries, nent, 0); if (page_owner->last_migrate_reason != -1) pr_alert("page has been migrated, last migrate reason: %s\n",