From patchwork Tue Nov 18 14:08:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 41041 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B3D0A24035 for ; Tue, 18 Nov 2014 14:31:34 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf12825744lbg.1 for ; Tue, 18 Nov 2014 06:31:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=Fi4f8t68VbCI7Z2QiWkZTvQ1S/Vc0qDQeFpHfzPy86c=; b=MXM4H0DneA7ebhTYotbYCwTinMLkWN2rCVtGaPffE8hBXTKMj3FaupSUHhGNVR3AFt jqgBsuoj9gWRzbhJrhEA88M5r80+TcTlgB1nEH+5WYZH38AYNfeN2575xLnVcbPKAYwR aQP9w3rL0BPFUGbZPDB2tJs4KQ2+6yhBozbC0t/jIGEInpID5CQdbC2H2HkreivCwsVe mnd1A2PgRCK1PpMFSCtC6LTgitTT5n6nbro/pO59y4kQrtiC4T2FaMJvj9E11EHaSXsu yXy+vrTczWJsSVD1OXh6rTdPKmQbtmw3SOCiNA6BMxtfpcfx6JFpSXgvfj9ULo1dXlUq 5b+w== X-Gm-Message-State: ALoCoQkS821vJW3cRmEPbwqgl0miSdPl9zNSb8IjQgQWLOPzaNqdQYcWt6EXOTSZA1MZFt8SKlXs X-Received: by 10.112.151.38 with SMTP id un6mr11424039lbb.0.1416321093231; Tue, 18 Nov 2014 06:31:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.132 with SMTP id k4ls835462lak.12.gmail; Tue, 18 Nov 2014 06:31:33 -0800 (PST) X-Received: by 10.112.148.161 with SMTP id tt1mr37417464lbb.67.1416321093014; Tue, 18 Nov 2014 06:31:33 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id y8si56059192laj.5.2014.11.18.06.31.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 06:31:32 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id 10so17544613lbg.21 for ; Tue, 18 Nov 2014 06:31:32 -0800 (PST) X-Received: by 10.152.37.69 with SMTP id w5mr36060805laj.67.1416321092867; Tue, 18 Nov 2014 06:31:32 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp1337459lbc; Tue, 18 Nov 2014 06:31:31 -0800 (PST) X-Received: by 10.66.191.165 with SMTP id gz5mr36735912pac.75.1416321090781; Tue, 18 Nov 2014 06:31:30 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sz3si38170363pab.188.2014.11.18.06.31.29 for ; Tue, 18 Nov 2014 06:31:30 -0800 (PST) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755767AbaKROb2 (ORCPT + 1 other); Tue, 18 Nov 2014 09:31:28 -0500 Received: from cantor2.suse.de ([195.135.220.15]:57040 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755121AbaKROKR (ORCPT ); Tue, 18 Nov 2014 09:10:17 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3456CAE43; Tue, 18 Nov 2014 14:09:25 +0000 (UTC) Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.83) (envelope-from ) id 1XqjTA-00025h-Nn; Tue, 18 Nov 2014 15:09:24 +0100 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Wang Nan , Steven Rostedt , Andrew Morton , Linus Torvalds , Jiri Slaby Subject: [PATCH 3.12 173/206] cgroup/kmemleak: add kmemleak_free() for cgroup deallocations. Date: Tue, 18 Nov 2014 15:08:48 +0100 Message-Id: X-Mailer: git-send-email 2.1.3 In-Reply-To: <28f04bcc068a44c5641c727883947960fb8dcbd5.1416319692.git.jslaby@suse.cz> References: <28f04bcc068a44c5641c727883947960fb8dcbd5.1416319692.git.jslaby@suse.cz> In-Reply-To: References: Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Wang Nan 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit 401507d67d5c2854f5a88b3f93f64fc6f267bca5 upstream. Commit ff7ee93f4715 ("cgroup/kmemleak: Annotate alloc_page() for cgroup allocations") introduces kmemleak_alloc() for alloc_page_cgroup(), but corresponding kmemleak_free() is missing, which makes kmemleak be wrongly disabled after memory offlining. Log is pasted at the end of this commit message. This patch add kmemleak_free() into free_page_cgroup(). During page offlining, this patch removes corresponding entries in kmemleak rbtree. After that, the freed memory can be allocated again by other subsystems without killing kmemleak. bash # for x in 1 2 3 4; do echo offline > /sys/devices/system/memory/memory$x/state ; sleep 1; done ; dmesg | grep leak Offlined Pages 32768 kmemleak: Cannot insert 0xffff880016969000 into the object search tree (overlaps existing) CPU: 0 PID: 412 Comm: sleep Not tainted 3.17.0-rc5+ #86 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 Call Trace: dump_stack+0x46/0x58 create_object+0x266/0x2c0 kmemleak_alloc+0x26/0x50 kmem_cache_alloc+0xd3/0x160 __sigqueue_alloc+0x49/0xd0 __send_signal+0xcb/0x410 send_signal+0x45/0x90 __group_send_sig_info+0x13/0x20 do_notify_parent+0x1bb/0x260 do_exit+0x767/0xa40 do_group_exit+0x44/0xa0 SyS_exit_group+0x17/0x20 system_call_fastpath+0x16/0x1b kmemleak: Kernel memory leak detector disabled kmemleak: Object 0xffff880016900000 (size 524288): kmemleak: comm "swapper/0", pid 0, jiffies 4294667296 kmemleak: min_count = 0 kmemleak: count = 0 kmemleak: flags = 0x1 kmemleak: checksum = 0 kmemleak: backtrace: log_early+0x63/0x77 kmemleak_alloc+0x4b/0x50 init_section_page_cgroup+0x7f/0xf5 page_cgroup_init+0xc5/0xd0 start_kernel+0x333/0x408 x86_64_start_reservations+0x2a/0x2c x86_64_start_kernel+0xf5/0xfc Fixes: ff7ee93f4715 (cgroup/kmemleak: Annotate alloc_page() for cgroup allocations) Signed-off-by: Wang Nan Acked-by: Johannes Weiner Acked-by: Michal Hocko Cc: Steven Rostedt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Jiri Slaby --- mm/page_cgroup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c index 6d757e3a872a..e007236f345a 100644 --- a/mm/page_cgroup.c +++ b/mm/page_cgroup.c @@ -170,6 +170,7 @@ static void free_page_cgroup(void *addr) sizeof(struct page_cgroup) * PAGES_PER_SECTION; BUG_ON(PageReserved(page)); + kmemleak_free(addr); free_pages_exact(addr, table_size); } }