From patchwork Tue Aug 20 13:18:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 11103811 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26ABB14F7 for ; Tue, 20 Aug 2019 13:18:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F26FE22DA7 for ; Tue, 20 Aug 2019 13:18:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F26FE22DA7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 15BF16B0269; Tue, 20 Aug 2019 09:18:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F361B6B0010; Tue, 20 Aug 2019 09:18:41 -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 C50BA6B000D; Tue, 20 Aug 2019 09:18:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 717556B000A for ; Tue, 20 Aug 2019 09:18:41 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 235C78248AB3 for ; Tue, 20 Aug 2019 13:18:41 +0000 (UTC) X-FDA: 75842860842.06.chain37_119559ddf484d X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,vbabka@suse.cz,::akpm@linux-foundation.org:linux-kernel@vger.kernel.org:kirill.shutemov@linux.intel.com:mhocko@kernel.org:mgorman@techsingularity.net:willy@infradead.org:vbabka@suse.cz,RULES_HIT:30054:30070:30075,0,RBL:195.135.220.15:@suse.cz:.lbl8.mailshell.net-62.2.6.2 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: chain37_119559ddf484d X-Filterd-Recvd-Size: 2388 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Aug 2019 13:18:40 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D0EACAC50; Tue, 20 Aug 2019 13:18:38 +0000 (UTC) From: Vlastimil Babka To: linux-mm@kvack.org, Andrew Morton Cc: linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Michal Hocko , Mel Gorman , Matthew Wilcox , Vlastimil Babka Subject: [PATCH v2 0/4] debug_pagealloc improvements through page_owner Date: Tue, 20 Aug 2019 15:18:24 +0200 Message-Id: <20190820131828.22684-1-vbabka@suse.cz> X-Mailer: git-send-email 2.22.0 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: v2: also fix THP split handling (added Patch 1) per Kirill The debug_pagealloc functionality serves a similar purpose on the page allocator level that slub_debug does on the kmalloc level, which is to detect bad users. One notable feature that slub_debug has is storing stack traces of who last allocated and freed the object. On page level we track allocations via page_owner, but that info is discarded when freeing, and we don't track freeing at all. This series improves those aspects. With both debug_pagealloc and page_owner enabled, we can then get bug reports such as the example in Patch 4. SLUB debug tracking additionaly stores cpu, pid and timestamp. This could be added later, if deemed useful enough to justify the additional page_ext structure size. Vlastimil Babka (4): mm, page_owner: handle THP splits correctly mm, page_owner: record page owner for each subpage mm, page_owner: keep owner info when freeing the page mm, page_owner, debug_pagealloc: save and dump freeing stack trace .../admin-guide/kernel-parameters.txt | 2 + include/linux/page_ext.h | 1 + mm/Kconfig.debug | 4 +- mm/huge_memory.c | 4 + mm/page_owner.c | 123 +++++++++++++----- 5 files changed, 100 insertions(+), 34 deletions(-)