Received: by 10.213.65.68 with SMTP id h4csp955958imn; Tue, 20 Mar 2018 21:39:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELvYgerrVA1beoivxSSrpUOJh6b89VxgVWPYAEj6R3dS2fw6G9TIi3Vo+ET63dzAw7N7ok/7 X-Received: by 10.99.49.143 with SMTP id x137mr14273761pgx.424.1521607169526; Tue, 20 Mar 2018 21:39:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521607169; cv=none; d=google.com; s=arc-20160816; b=Fw02nLqrqDFhWa55rzVmJMT1c2N77nNJeeypEVfss8fLizTdGt9NiXxkTlum3O58nS aqRL5hiuQWdX1m2k3IiS2piCGtPE55J8T/rNxrjvbzVeE1tz3E/30AYcZPJDWxW7I92r 0r3Rlz0LG+i+AcgU75LMr9RnP2x2W3WlN282Ze/3YJusCJX+NxJqqXeh8TTwKVADpGmS w8pll6B0SWX7g+reqUGaIZHsZJjavu55wMuzO7NFXArcZBhowITJ06T8DstZ1F//qSrp rzOdKcSuFBYTGye7Q0nvZYK8YGjpq1GFT40ETPZHuy60fzjZbinMw71XhJHR1pQj2gJJ FjHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=oSwT8cMfLLqy6Q7zLCA9YdgYcGnTD3QarsanydAlFPY=; b=0Ii4AMpwEaX5n0IZVmEcA4SJYmnfYo4/QR0CTHRKLqA9IlsEzBTFUjwwCC+/ejCX5G dYq8UymKyBBst8N9rkdlqvHt0BB19NQuOKb0DThX0cGhexRrVRbdKGctDN4d+soup80X tYWt90NQp6G6gqsmox4HBqrW2aYzm1UMvb9aJjNZ5QgI5df2VofvBTbbPrSv8QUsLoYL RHhOl914nB0KQoZF1REYJKrp7XQTgrZJqgNMlGeth0DVZowP578WFicSkjEVVSEls2jW z7Lt1r2Q5C3Woo+9hctsqDi/nOrVtDsWmyOP09joMaVXIQRRHHfLI9HuE5GKBLKnYGjY d2ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=okiOoOsU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h22-v6si3060244plr.668.2018.03.20.21.39.15; Tue, 20 Mar 2018 21:39:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=okiOoOsU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751834AbeCUEiX (ORCPT + 99 others); Wed, 21 Mar 2018 00:38:23 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:43400 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751481AbeCUEiW (ORCPT ); Wed, 21 Mar 2018 00:38:22 -0400 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20180321043820epoutp048ca3250cba75aa1a5dd4c91fa4bd2629~d1ZiWVGQw1658016580epoutp048 for ; Wed, 21 Mar 2018 04:38:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20180321043820epoutp048ca3250cba75aa1a5dd4c91fa4bd2629~d1ZiWVGQw1658016580epoutp048 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1521607100; bh=oSwT8cMfLLqy6Q7zLCA9YdgYcGnTD3QarsanydAlFPY=; h=From:To:Cc:Subject:Date:References:From; b=okiOoOsU06FzZTwmHs8Z/1oE09ZI+8xaGr58i6Z2QB/0iIfhBLKtwHoxvF50G3BgE YFbDjLFHUmq47h9iSg4JJC0xHruSjkr7KPSE53nNj7xkYshbszU4L8cjsTwMPZPmhl qo10GscH59kgtkfcHMW49EF3qgpUmZgqsEuXWsjs= Received: from epsmges5p2new.samsung.com (unknown [182.195.40.72]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20180321043819epcas5p3bb83ad6b30d384de357c2e7bd2a79067~d1ZhUkWyl2075620756epcas5p3x; Wed, 21 Mar 2018 04:38:19 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 80.D5.04389.BB1E1BA5; Wed, 21 Mar 2018 13:38:19 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20180321043818epcas5p176fe0e0bbfce685420df2bfb7a421acd~d1Zg_ii451381913819epcas5p1e; Wed, 21 Mar 2018 04:38:18 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180321043818epsmtrp2150e2c1a6a57d3b981fdf1e2aed5685a~d1Zg8RqjJ0248502485epsmtrp2O; Wed, 21 Mar 2018 04:38:18 +0000 (GMT) X-AuditID: b6c32a4a-de3ff70000001125-4d-5ab1e1bbb1ae Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D3.28.03798.AB1E1BA5; Wed, 21 Mar 2018 13:38:18 +0900 (KST) Received: from localhost.localdomain (unknown [107.108.92.210]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20180321043811epsmtip12d541542de9191dd743dd6b7cf546e44~d1ZZ6ic1F1386413864epsmtip1L; Wed, 21 Mar 2018 04:38:10 +0000 (GMT) From: Maninder Singh To: akpm@linux-foundation.org, vbabka@suse.cz, mhocko@suse.com, osalvador@techadventures.net, gregkh@linuxfoundation.org, ayush.m@samsung.com, guptap@codeaurora.org, vinmenon@codeaurora.org, gomonovych@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, a.sahrawat@samsung.com, pankaj.m@samsung.com, Maninder Singh , Vaneet Narang Subject: [PATCH 1/1] mm/page_owner: fix recursion bug after changing skip entries Date: Wed, 21 Mar 2018 10:07:23 +0530 Message-Id: <1521607043-34670-1-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGJsWRmVeSWpSXmKPExsWy7bCmpu7uhxujDH7P4rO4uDvVYs76NWwW V37vZ7c4/PAtq0Xz4vVsFt8ermCzuLxrDpvFvTX/WS0Oz29jsbjf52CxdOs/Jot7b7YyWRw6 OZfRYnZjH6PF+q0H2B34PS739TJ57Jx1l91j06dJ7B4nZvxm8dg/dw27R9+WVYwe67dcZfE4 s+AIu8fsvdfZPT5vkgvgikq1yUhNTEktUkjNS85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvM TbVVcvEJ0HXLzAH6QkmhLDGnFCgUkFhcrKRvZ1OUX1qSqpCRX1xiqxRtaGikZ2hgrmdkZKRn YhprZWQKVJKQmrFt0jm2gq1CFX3XpjA1MD7n62Lk5JAQMJG4dfYESxcjF4eQwG5Gibcrm5kh nE+MEo/vbWaCcL4xSny638MO09K7fikjRGIvo8SG5d+YQBJCAl8YJV7PFQOx2QT0JFbt2gM2 V0TgJqPEnE9nweYyC2xjlNg5azILSJWwQLDEsvOTWEFsFgFVie8H54Gt4BVwlzj0rp8FYp2c xMljk1lBmiUEHrNJHFhzCSjBAeS4SDR0pULUCEu8Or4F6j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i FOBgVOLhtRDbGCXEmlhWXJl7iFGCg1lJhPdQBFCINyWxsiq1KD++qDQntfgQozQHi5I4r3z+ sUghgfTEktTs1NSC1CKYLBMHp1QDY4+s2JGMxz4/605/nV7dmxB/MJ6r+td1ubiDH9oKmO9z nTPeELz75gvDrRH1v5VW1fx22vVsUvVut6+87AIzV8ybKP/4slzE5cUrzG77+hoz2/5ZULt9 l+xCg9Wzp/WfOmqW+llgukHlpJaeZdGTLI/l7d68LibzPtAUvY27fBVOal78u2pDjBJLcUai oRZzUXEiAIDFNvlgAgAA X-CMS-MailID: 20180321043818epcas5p176fe0e0bbfce685420df2bfb7a421acd X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-MTR: 20180321043818epcas5p176fe0e0bbfce685420df2bfb7a421acd CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180321043818epcas5p176fe0e0bbfce685420df2bfb7a421acd X-RootMTR: 20180321043818epcas5p176fe0e0bbfce685420df2bfb7a421acd References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes "5f48f0bd4e368425db4424b9afd1bd251d32367a". (mm, page_owner: skip unnecessary stack_trace entries) Because if we skip first two entries then logic of checking count value as 2 for recursion is broken and code will go in one depth recursion. so we need to check only one call of _RET_IP(__set_page_owner) while checking for recursion. Current Backtrace while checking for recursion:- (save_stack) from (__set_page_owner) // (But recursion returns true here) (__set_page_owner) from (get_page_from_freelist) (get_page_from_freelist) from (__alloc_pages_nodemask) (__alloc_pages_nodemask) from (depot_save_stack) (depot_save_stack) from (save_stack) // recursion should return true here (save_stack) from (__set_page_owner) (__set_page_owner) from (get_page_from_freelist) (get_page_from_freelist) from (__alloc_pages_nodemask+) (__alloc_pages_nodemask) from (depot_save_stack) (depot_save_stack) from (save_stack) (save_stack) from (__set_page_owner) (__set_page_owner) from (get_page_from_freelist) Correct Backtrace with fix: (save_stack) from (__set_page_owner) // recursion returned true here (__set_page_owner) from (get_page_from_freelist) (get_page_from_freelist) from (__alloc_pages_nodemask+) (__alloc_pages_nodemask) from (depot_save_stack) (depot_save_stack) from (save_stack) (save_stack) from (__set_page_owner) (__set_page_owner) from (get_page_from_freelist) Signed-off-by: Maninder Singh Signed-off-by: Vaneet Narang --- mm/page_owner.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/page_owner.c b/mm/page_owner.c index 8592543..46ab1c4 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -123,13 +123,13 @@ void __reset_page_owner(struct page *page, unsigned int order) static inline bool check_recursive_alloc(struct stack_trace *trace, unsigned long ip) { - int i, count; + int i; if (!trace->nr_entries) return false; - for (i = 0, count = 0; i < trace->nr_entries; i++) { - if (trace->entries[i] == ip && ++count == 2) + for (i = 0; i < trace->nr_entries; i++) { + if (trace->entries[i] == ip) return true; } -- 1.7.1