From patchwork Sat Apr 11 22:03:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11484241 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 B7A4492C for ; Sat, 11 Apr 2020 22:04:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 83AED214D8 for ; Sat, 11 Apr 2020 22:04:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cgf+yG0y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83AED214D8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 146CA8E00B4; Sat, 11 Apr 2020 18:04:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0CFE38E0007; Sat, 11 Apr 2020 18:04:26 -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 ED9FD8E00B4; Sat, 11 Apr 2020 18:04:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id D41D18E0007 for ; Sat, 11 Apr 2020 18:04:25 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8C15D2C8B for ; Sat, 11 Apr 2020 22:04:25 +0000 (UTC) X-FDA: 76696953690.19.tank38_60d05dc843353 X-Spam-Summary: 2,0,0,37d38bba7a604452,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3871:4321:5007:6261:6653:7514:8957:9413:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13069:13255:13311:13357:14096:14181:14384:14687:14721:21080:21444:21451:21627:21666:21990:30054,0,RBL:209.85.128.66:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,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:24,LUA_SUMMARY:none X-HE-Tag: tank38_60d05dc843353 X-Filterd-Recvd-Size: 4503 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Sat, 11 Apr 2020 22:04:25 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id y24so6210586wma.4 for ; Sat, 11 Apr 2020 15:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7awknHCHreVUL7HOgEtOc8fPTfDMmoiQP0NsrxPQ1o8=; b=cgf+yG0ytzZcljetiqszYQFSLXzHNdp4ie3DCzZjeBS7YN3iEEtZTMmns/RaStrAJl dNx0Cx9XpgZEpCvqS+85DM9C/qN0T2ydqQF71ExyeHpWmkkW0FjiCRp/GK8ft5rH6NlW HQG7uT88zPJGoHg39qODkdBkDYncSd1pC7oX7NWFUNGeYHxvUW86wXT6PLCA2q17Cju3 29ffg1/dakVM7ZJyBSKF+3f8K1QZLF05AEQqNPVdFx43ft6xY6ICPb4bpRIpVL0i45UC jwpeFQQRqkYtFzerBwFdtR6u4znwFKE4dE7A9gmA28ArizyHXcbGELzv2duPsSZbpCy6 Oryg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7awknHCHreVUL7HOgEtOc8fPTfDMmoiQP0NsrxPQ1o8=; b=ufGgmt8qeXJkM09zXZGbqwWlgLpg3ULnNJ/e/j/wdcj75UULqcrtqU32ejIUJUR+JH ui6MIno7yMLWyWYHfQ2zTVF2sviFpKYjaiKGALVLy9/hNwynHzJJiYg0Yy6/ySWPw8K6 cAV4acJz6A6Ak/wnuS2MqRGwZxXFgI9gfLdmpHfHE1Sh32M7mnu0GNQ/Zu0KNI979CLz rU9hDK3mnANG7n0jsKpXwnIgKbeLw7CCd1/ezupZgnw0vdorMnyOyKgN+Zu6ABkqDkFQ d3TEilitL14/c/x6DKBIkQqu5jZQtJAYuWLDlJfFF4wuG2RG1hdxmBw/xVKprGhbOgmN s2wQ== X-Gm-Message-State: AGi0PualqiOu95AvYdfhTLGqMCFT5b76kYouqnE/SIWa/JhT916q1VZ2 zHLWD/dm2X7NgDMQaZ7MLzc= X-Google-Smtp-Source: APiQypLJte/8h1XPH3mWhbw57nwf2wLT6tGlCTzV7+vyIqii7e/6lamZUdFuOsmP/vekvPKrUbGV2g== X-Received: by 2002:a1c:8106:: with SMTP id c6mr11350070wmd.88.1586642664302; Sat, 11 Apr 2020 15:04:24 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id h2sm7939369wmb.16.2020.04.11.15.04.23 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Apr 2020 15:04:23 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, rientjes@google.com, anshuman.khandual@arm.com, david@redhat.com, Wei Yang Subject: [Patch v3 1/5] mm/page_alloc.c: bad_[reason|flags] is not necessary when PageHWPoison Date: Sat, 11 Apr 2020 22:03:53 +0000 Message-Id: <20200411220357.9636-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200411220357.9636-1-richard.weiyang@gmail.com> References: <20200411220357.9636-1-richard.weiyang@gmail.com> 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: Since function returns directly, bad_[reason|flags] is not used any where. And move this to the first. This is a following cleanup for commit e570f56cccd21 ("mm: check_new_page_bad() directly returns in __PG_HWPOISON case") Signed-off-by: Wei Yang Acked-by: Michal Hocko Reviewed-by: David Hildenbrand --- v3: * move this handling to the first case --- mm/page_alloc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f49f28f1220b..7327dc039069 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2037,19 +2037,17 @@ static void check_new_page_bad(struct page *page) const char *bad_reason = NULL; unsigned long bad_flags = 0; + if (unlikely(page->flags & __PG_HWPOISON)) { + /* Don't complain about hwpoisoned pages */ + page_mapcount_reset(page); /* remove PageBuddy */ + return; + } if (unlikely(atomic_read(&page->_mapcount) != -1)) bad_reason = "nonzero mapcount"; if (unlikely(page->mapping != NULL)) bad_reason = "non-NULL mapping"; if (unlikely(page_ref_count(page) != 0)) bad_reason = "nonzero _refcount"; - if (unlikely(page->flags & __PG_HWPOISON)) { - bad_reason = "HWPoisoned (hardware-corrupted)"; - bad_flags = __PG_HWPOISON; - /* Don't complain about hwpoisoned pages */ - page_mapcount_reset(page); /* remove PageBuddy */ - return; - } if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) { bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; bad_flags = PAGE_FLAGS_CHECK_AT_PREP; From patchwork Sat Apr 11 22:03:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11484243 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 7B96514DD for ; Sat, 11 Apr 2020 22:04:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 38B8A2051A for ; Sat, 11 Apr 2020 22:04:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KX7MafkC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38B8A2051A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F27688E00B5; Sat, 11 Apr 2020 18:04:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id ED9288E0007; Sat, 11 Apr 2020 18:04:26 -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 DC5C58E00B5; Sat, 11 Apr 2020 18:04:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id C44CF8E0007 for ; Sat, 11 Apr 2020 18:04:26 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 759C08248068 for ; Sat, 11 Apr 2020 22:04:26 +0000 (UTC) X-FDA: 76696953732.06.jelly38_60f0995346c60 X-Spam-Summary: 2,0,0,df4ad210702f7b64,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:69:355:379:541:800:960:966:973:988:989:1260:1345:1359:1431:1437:1535:1544:1711:1730:1747:1777:1792:1963:2196:2199:2393:2553:2559:2562:3138:3139:3140:3141:3142:3355:3865:3866:3867:3870:3871:3872:4118:4321:4385:5007:6261:6653:7514:8634:8957:9413:9592:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12683:12895:12986:14093:14096:14110:14181:14687:14721:21080:21444:21451:21611:21627:21666:30045:30054:30056:30090,0,RBL:209.85.128.67:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,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:24,LUA_SUMMARY:none X-HE-Tag: jelly38_60f0995346c60 X-Filterd-Recvd-Size: 7097 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Sat, 11 Apr 2020 22:04:26 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id h2so5878997wmb.4 for ; Sat, 11 Apr 2020 15:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KKsXg0f3NdD1RgFQXGmR3Fbu1r4vifzR97uuZQ5qjxM=; b=KX7MafkC1W+C1oiAguRgAmmQ/8zUrKPK8XaJYVtkuGY17lbmlcE4iAmUjCzZDT4n/o 2bGqKBG4tHWUW1Sa0yU7by6nwTLUANieKuSHg2cGwaK3IQtfGIJ+Bpp0+abAMVrnJV5N idBxWJjRzEtxFcah/mq72O5dOLy++kAoLkKQeLfLYmSk/1bNhu+yJ/arzcob8PU63M6u 6TquNrmu0HmB5RNuuBfe+jUnfin8pZHZ6vWX7BqCMqEvSWDd7xjtyHQrEq/l28tZAl4q m+rxIBjcvVHZV7t/eGvRoCbD603Gz7+baSnBdQu5q3FdcYqrgkxwFfV83KZSozY+btW5 zVbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KKsXg0f3NdD1RgFQXGmR3Fbu1r4vifzR97uuZQ5qjxM=; b=AAyFW1L9ghsvmcWnMPREBrMU9KP9JUJZL1d6RwnuyGrkw6rnRvs0A1J3X9IujeYwu6 Yv8rPCVUyWy0064RLoICEKOcx/3AhzZHUg/6/WB2xy/++ViqHNwD+eNyby6Z/ELOdmqa KXCed801QnQyxYTcwgZSNijyRwVioKUPZMohLIDNA+co7MxJ40d9g7LCHs54ghqFztRk 0kCgSyI/9Kyk+tNw4rTokUBIQX7AG8KsN4LIAPrGCQv2CNWSEMdlEumN+g9r6g+LOww+ vqaBcM6aUUJudTY/z6IFaKDCT5Reols5FGtSHw3yKxNCwl8Mw9RVs+awo0oZTb9b0PTa hZtQ== X-Gm-Message-State: AGi0PuZKyVPJT+VoNaI40zpCjh4yv6P7t/2bCAn0HNNfpdhXk3ihrUam CvSQy+T/FIfdihykhbcRcDo= X-Google-Smtp-Source: APiQypKDq4zw21MwouB45kwsXuN8oJITstl2Ai6k0dSWqFCNwuWm6Q/U39+UCda6DFzIsZlamMpr7Q== X-Received: by 2002:a1c:2b06:: with SMTP id r6mr12167201wmr.25.1586642665117; Sat, 11 Apr 2020 15:04:25 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a15sm7944996wme.17.2020.04.11.15.04.24 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Apr 2020 15:04:24 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, rientjes@google.com, anshuman.khandual@arm.com, david@redhat.com, Wei Yang Subject: [Patch v3 2/5] mm/page_alloc.c: bad_flags is not necessary for bad_page() Date: Sat, 11 Apr 2020 22:03:54 +0000 Message-Id: <20200411220357.9636-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200411220357.9636-1-richard.weiyang@gmail.com> References: <20200411220357.9636-1-richard.weiyang@gmail.com> 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: After commit 5b57b8f22709 ("mm/debug.c: always print flags in dump_page()"), page->flags is always printed for a bad page. It is not necessary to have bad_flags any more. Signed-off-by: Wei Yang Suggested-by: Anshuman Khandual --- mm/page_alloc.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 7327dc039069..0648127af872 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -602,8 +602,7 @@ static inline int __maybe_unused bad_range(struct zone *zone, struct page *page) } #endif -static void bad_page(struct page *page, const char *reason, - unsigned long bad_flags) +static void bad_page(struct page *page, const char *reason) { static unsigned long resume; static unsigned long nr_shown; @@ -632,10 +631,6 @@ static void bad_page(struct page *page, const char *reason, pr_alert("BUG: Bad page state in process %s pfn:%05lx\n", current->comm, page_to_pfn(page)); __dump_page(page, reason); - bad_flags &= page->flags; - if (bad_flags) - pr_alert("bad because of flags: %#lx(%pGp)\n", - bad_flags, &bad_flags); dump_page_owner(page); print_modules(); @@ -1020,11 +1015,7 @@ static inline bool page_expected_state(struct page *page, static void free_pages_check_bad(struct page *page) { - const char *bad_reason; - unsigned long bad_flags; - - bad_reason = NULL; - bad_flags = 0; + const char *bad_reason = NULL; if (unlikely(atomic_read(&page->_mapcount) != -1)) bad_reason = "nonzero mapcount"; @@ -1032,15 +1023,13 @@ static void free_pages_check_bad(struct page *page) bad_reason = "non-NULL mapping"; if (unlikely(page_ref_count(page) != 0)) bad_reason = "nonzero _refcount"; - if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_FREE)) { + if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_FREE)) bad_reason = "PAGE_FLAGS_CHECK_AT_FREE flag(s) set"; - bad_flags = PAGE_FLAGS_CHECK_AT_FREE; - } #ifdef CONFIG_MEMCG if (unlikely(page->mem_cgroup)) bad_reason = "page still charged to cgroup"; #endif - bad_page(page, bad_reason, bad_flags); + bad_page(page, bad_reason); } static inline int free_pages_check(struct page *page) @@ -1071,7 +1060,7 @@ static int free_tail_pages_check(struct page *head_page, struct page *page) case 1: /* the first tail page: ->mapping may be compound_mapcount() */ if (unlikely(compound_mapcount(page))) { - bad_page(page, "nonzero compound_mapcount", 0); + bad_page(page, "nonzero compound_mapcount"); goto out; } break; @@ -1083,17 +1072,17 @@ static int free_tail_pages_check(struct page *head_page, struct page *page) break; default: if (page->mapping != TAIL_MAPPING) { - bad_page(page, "corrupted mapping in tail page", 0); + bad_page(page, "corrupted mapping in tail page"); goto out; } break; } if (unlikely(!PageTail(page))) { - bad_page(page, "PageTail not set", 0); + bad_page(page, "PageTail not set"); goto out; } if (unlikely(compound_head(page) != head_page)) { - bad_page(page, "compound_head not consistent", 0); + bad_page(page, "compound_head not consistent"); goto out; } ret = 0; @@ -2035,7 +2024,6 @@ static inline void expand(struct zone *zone, struct page *page, static void check_new_page_bad(struct page *page) { const char *bad_reason = NULL; - unsigned long bad_flags = 0; if (unlikely(page->flags & __PG_HWPOISON)) { /* Don't complain about hwpoisoned pages */ @@ -2048,15 +2036,13 @@ static void check_new_page_bad(struct page *page) bad_reason = "non-NULL mapping"; if (unlikely(page_ref_count(page) != 0)) bad_reason = "nonzero _refcount"; - if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) { + if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; - bad_flags = PAGE_FLAGS_CHECK_AT_PREP; - } #ifdef CONFIG_MEMCG if (unlikely(page->mem_cgroup)) bad_reason = "page still charged to cgroup"; #endif - bad_page(page, bad_reason, bad_flags); + bad_page(page, bad_reason); } /* From patchwork Sat Apr 11 22:03:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11484245 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 98BF314DD for ; Sat, 11 Apr 2020 22:04:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6550A2051A for ; Sat, 11 Apr 2020 22:04:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="chgPPt02" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6550A2051A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E3CF38E00B6; Sat, 11 Apr 2020 18:04:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DF0E48E0007; Sat, 11 Apr 2020 18:04:27 -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 B7C718E00B6; Sat, 11 Apr 2020 18:04:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id 99D398E0007 for ; Sat, 11 Apr 2020 18:04:27 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 52A24499615 for ; Sat, 11 Apr 2020 22:04:27 +0000 (UTC) X-FDA: 76696953774.04.crowd13_61124e83f9e10 X-Spam-Summary: 2,0,0,5fab1f170cbad4cf,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:965:966:973:988:989:1260:1345:1359:1437:1534:1540:1711:1714:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3351:3865:3866:3867:3871:3872:4321:4385:4390:4395:5007:6261:6653:7514:9413:10004:11026:11658:11914:12114:12297:12438:12517:12519:12555:12895:13069:13255:13311:13357:14096:14181:14384:14687:14721:21080:21324:21444:21627:21666:21990:30029:30054,0,RBL:209.85.128.65:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,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:23,LUA_SUMMARY:none X-HE-Tag: crowd13_61124e83f9e10 X-Filterd-Recvd-Size: 3749 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Sat, 11 Apr 2020 22:04:26 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id v8so7323229wma.0 for ; Sat, 11 Apr 2020 15:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HloapMrTBbqZ+nTqkRH5KhOauRgcgw6WdiZ5Tk8uSNs=; b=chgPPt02lSLt2BSMGRU0pTejdXcwcYFgZCIwRwJqXMuTbCkswQSP3glvvzx18CJZBI Uasjm6ZXZ8ikkX56wWvNiYc+758d4+uWZ/OqH0T7v5eazJC/F3VFvrr2f7BCEdTQQ9/z XCbfd3dhzlYdE7tb9fyWpM4g2LxsmqF656/FvqLssOF5wO5/F08jckFwQoN7MeBNLL1O ea9PClEMoqSqWO9NFsxj/IEYmH4mXoTvywNOLcgI1WEy2ViWB2l1SZ0LtlS+sr/tpgGM Z5FsGuLQh8l5+0EFbXIX8CTMVyRgGSHGY7yV+qUHC5NnVJA2c4lVzSE+kTsUkRhzqrXQ KXrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HloapMrTBbqZ+nTqkRH5KhOauRgcgw6WdiZ5Tk8uSNs=; b=Z+xn5vwgDE3bV5+1f8QI9QS5nDScLX30ApURhSIHYDWrWqdSn2jPA0Iy6bFCv3f87T grR4uwdPT9YJEjQ5kHKqmOQ+kLs2VAzD8APu8NfDLri8iBkRQQ36w7FDJ3/cCAkspAjq Hmq2cneJg1bQ7unADtgs28kPhlIXHXG/k0nC4rlVd7it6txzD5WhRYUJfBMrrE8tvZG1 OtK/D3n+McDZD8EJkE7r63ynx9gUvmjwO3vzDCErMJsOoyS6viS/hkYqbxuAhjGbsLku 53+ablhAHwP9ev5F04wQz2w1C9oK/vub6iuokc7JUtLKMF8O4JFAw4RAp3CUfId3L61v bxrw== X-Gm-Message-State: AGi0PuYRAWEDXj9n5n2BgCEdFSEUeIOkWLf6Ck07AMMPsSnUHpa1dZp2 3tCDnfsfxl73rfR/43gMz9k= X-Google-Smtp-Source: APiQypKEKVP/CHvgZum2u6S6RrESZKdY7U9o9KPcFWC9g7fhISobWofHL0gNM4tnu1NTuibz8eh/FA== X-Received: by 2002:a1c:1f8e:: with SMTP id f136mr11168293wmf.166.1586642666074; Sat, 11 Apr 2020 15:04:26 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id e11sm9307275wrs.82.2020.04.11.15.04.25 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Apr 2020 15:04:25 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, rientjes@google.com, anshuman.khandual@arm.com, david@redhat.com, Wei Yang Subject: [Patch v3 3/5] mm/page_alloc.c: rename free_pages_check_bad() to check_free_page_bad() Date: Sat, 11 Apr 2020 22:03:55 +0000 Message-Id: <20200411220357.9636-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200411220357.9636-1-richard.weiyang@gmail.com> References: <20200411220357.9636-1-richard.weiyang@gmail.com> 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: Function free_pages_check_bad() is the counterpart of check_new_page_bad(). Rename it to use the same name convention. Signed-off-by: Wei Yang --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0648127af872..85d7aec5fb45 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1013,7 +1013,7 @@ static inline bool page_expected_state(struct page *page, return true; } -static void free_pages_check_bad(struct page *page) +static void check_free_page_bad(struct page *page) { const char *bad_reason = NULL; @@ -1038,7 +1038,7 @@ static inline int free_pages_check(struct page *page) return 0; /* Something has gone sideways, find it */ - free_pages_check_bad(page); + check_free_page_bad(page); return 1; } From patchwork Sat Apr 11 22:03:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11484247 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 A2EAE92C for ; Sat, 11 Apr 2020 22:04:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6F8722051A for ; Sat, 11 Apr 2020 22:04:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rdudLdLt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F8722051A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E640A8E00B7; Sat, 11 Apr 2020 18:04:28 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E146C8E0007; Sat, 11 Apr 2020 18:04:28 -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 D2BF28E00B7; Sat, 11 Apr 2020 18:04:28 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0238.hostedemail.com [216.40.44.238]) by kanga.kvack.org (Postfix) with ESMTP id B91278E0007 for ; Sat, 11 Apr 2020 18:04:28 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6F46D180AD801 for ; Sat, 11 Apr 2020 22:04:28 +0000 (UTC) X-FDA: 76696953816.02.bird03_613833c661150 X-Spam-Summary: 2,0,0,5f5111d4f47a2875,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:965:966:973:988:989:1260:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2731:2898:3138:3139:3140:3141:3142:3352:3865:3866:3867:3871:3872:4321:4385:4390:4395:5007:6261:6653:7514:8957:9413:10004:11026:11473:11658:11914:12043:12297:12438:12517:12519:12555:12895:13069:13311:13357:14096:14181:14384:14687:14721:21080:21444:21627:21666:21990:30029:30054:30070,0,RBL:209.85.221.66:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,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:23,LUA_SUMMARY:none X-HE-Tag: bird03_613833c661150 X-Filterd-Recvd-Size: 4713 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Sat, 11 Apr 2020 22:04:27 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id k11so5569917wrp.5 for ; Sat, 11 Apr 2020 15:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zI3tJmo+o+GXkNWorcFoXLz8vYcrcpDEFf4n0oB8dNo=; b=rdudLdLt+Nawf50OHLaGEZbuSLmsPXhfz7lk7AKWyU+MhDQEl+Y34nrbTY91Xft7O7 huTPmx4+3g4uAr1AZdQCTU6SAc3HlxQYB6/wuyehgG7lg59f2me4HHh/kMcNo8HZmWFh 7+wtHc9/sjpH9wPhXW80/8CVbvj+spUhdNnjLDDUtpAJ1t3IDWaRiWXYbaI165tE2aYt 9xT4we8RjKhbxzq5yNXiVAgGctE1AjiHpa+Dgo46he3PWO/te3c9+OSjoCLjSeObcgTe +LVKowsccr2I6H95b+3EnG5w7+7s1Ot5MPMnNqeEWAfDGx/7uRucaksMVGK+qkOcrEPw UDSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zI3tJmo+o+GXkNWorcFoXLz8vYcrcpDEFf4n0oB8dNo=; b=AdvKUgt8Mu3oeCo3pLx8BL6NXHp7qyjL4svbhrQdyOmOoFdj6B/XcpMVs6vhcijjSv cVDlBLaUYJTdEa33gQmYIz1p4KOmBwfRIx4zYhMsXFKu0AUCA76NjJ/4pLE3oz+NC6O9 p7ioN0O8hsKa0INLZW9AGRqx+8YpIbrNX0yI6u6njNSpWtkm2kjj9gsIrFDHIzo8OEjq 2N33yrDCegmBSJougwoPKPxGjiEIYXZg8C6W063Fcwlbvrd7+k+ICy5IJEIVsy/a2udl 9dU29qRodHff3CrbyC10TV+0EOUgg26SWoUNQncs+0RKcyxYkqfI3AS3zXYX135w4AEW I18w== X-Gm-Message-State: AGi0PuaM+DVUwfiA+YN5kmkx9867SS4k4XAhPnJCcqTGtJtW7Td/41qB W/9KgaOBQAoJhmFsSeinU5g= X-Google-Smtp-Source: APiQypJzdDa9QVHQo9kjB6Ga1pafDzWMGvrAsY+GfYzFLV0mb7eFmzRw19RNwSps0T8fxOPOM+LKMA== X-Received: by 2002:a5d:66c4:: with SMTP id k4mr12151090wrw.53.1586642667016; Sat, 11 Apr 2020 15:04:27 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id z18sm2342424wrw.41.2020.04.11.15.04.26 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Apr 2020 15:04:26 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, rientjes@google.com, anshuman.khandual@arm.com, david@redhat.com, Wei Yang Subject: [Patch v3 4/5] mm/page_alloc.c: rename free_pages_check() to check_free_page() Date: Sat, 11 Apr 2020 22:03:56 +0000 Message-Id: <20200411220357.9636-5-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200411220357.9636-1-richard.weiyang@gmail.com> References: <20200411220357.9636-1-richard.weiyang@gmail.com> 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: Function free_pages_check() is the counterpart of check_new_page(). Rename it to use the same name convention. Signed-off-by: Wei Yang --- mm/page_alloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 85d7aec5fb45..dfcf2682ed40 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1032,7 +1032,7 @@ static void check_free_page_bad(struct page *page) bad_page(page, bad_reason); } -static inline int free_pages_check(struct page *page) +static inline int check_free_page(struct page *page) { if (likely(page_expected_state(page, PAGE_FLAGS_CHECK_AT_FREE))) return 0; @@ -1124,7 +1124,7 @@ static __always_inline bool free_pages_prepare(struct page *page, for (i = 1; i < (1 << order); i++) { if (compound) bad += free_tail_pages_check(page, page + i); - if (unlikely(free_pages_check(page + i))) { + if (unlikely(check_free_page(page + i))) { bad++; continue; } @@ -1136,7 +1136,7 @@ static __always_inline bool free_pages_prepare(struct page *page, if (memcg_kmem_enabled() && PageKmemcg(page)) __memcg_kmem_uncharge(page, order); if (check_free) - bad += free_pages_check(page); + bad += check_free_page(page); if (bad) return false; @@ -1183,7 +1183,7 @@ static bool free_pcp_prepare(struct page *page) static bool bulkfree_pcp_prepare(struct page *page) { if (debug_pagealloc_enabled_static()) - return free_pages_check(page); + return check_free_page(page); else return false; } @@ -1204,7 +1204,7 @@ static bool free_pcp_prepare(struct page *page) static bool bulkfree_pcp_prepare(struct page *page) { - return free_pages_check(page); + return check_free_page(page); } #endif /* CONFIG_DEBUG_VM */ From patchwork Sat Apr 11 22:03:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11484249 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 A7A7214DD for ; Sat, 11 Apr 2020 22:04:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6A70A21D79 for ; Sat, 11 Apr 2020 22:04:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c4MHe/3V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A70A21D79 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B58B68E00B8; Sat, 11 Apr 2020 18:04:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A96618E0007; Sat, 11 Apr 2020 18:04:29 -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 90C028E00B8; Sat, 11 Apr 2020 18:04:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0224.hostedemail.com [216.40.44.224]) by kanga.kvack.org (Postfix) with ESMTP id 7A5BE8E0007 for ; Sat, 11 Apr 2020 18:04:29 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3E484180AD801 for ; Sat, 11 Apr 2020 22:04:29 +0000 (UTC) X-FDA: 76696953858.18.actor39_6156cc7bf8959 X-Spam-Summary: 2,0,0,d3306a73b8cd45a9,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:69:355:379:541:800:960:965:966:968:973:988:989:1260:1345:1359:1437:1535:1542:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3867:3868:3870:3872:4321:4385:4390:4395:5007:6261:6653:7514:8957:9413:9592:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12683:12895:13255:14093:14096:14110:14181:14687:14721:21080:21222:21444:21451:21627:21666:21990:30012:30054:30070,0,RBL:209.85.128.68:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,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:24,LUA_SUMMARY:none X-HE-Tag: actor39_6156cc7bf8959 X-Filterd-Recvd-Size: 5459 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Sat, 11 Apr 2020 22:04:28 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id f20so6217306wmh.3 for ; Sat, 11 Apr 2020 15:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6gEeOq1PpVccr4Ato7Vi1Z7FE4EOOe1QHjHjHnCaqcc=; b=c4MHe/3VZ7ToP2vIz7fdoLygs+mLdgRlTe9FV0TZUrGDmeZSSh1eBse+LrunRPTkln 5U4FTU3E7CRl8hU6Rdj53McU49Jo0NeTBmKaySQ+x3bKxMOQzciz7rsBIm9kBIp3yWOb 6CgCv/WRdo0sTnT7/NEcHNc6EQE9zxpPawBXSqjoLOmE/2vnuyjLgomsm2VF6Pc3AXfx 0FwDpAGl0/CzflsTE9JmN6aRrDyylcbbWTe76Nszk2RVBk2pz4Vpd5UKKtw4bRp+PuMa CTs+bo99R/SwsNu4XGOvmgg790dEzsuD+vPr8Vj5joBjiLDSmvyDSFMoRVYf8MiidnGP UeUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6gEeOq1PpVccr4Ato7Vi1Z7FE4EOOe1QHjHjHnCaqcc=; b=eP/9OeUKXYqsbNU/rm+5ueiGqVKpFM1FXG8eVt7soJRL8GBbpdU34y7C10QDcxjFoa vPDzaJSYKeevqARnPjlj/nNI7Iah6MpI61vcR+C0PZk9aErPRIU5fqhqfB7ZkIGFRf+s x2a8DJ4fv80t6YoC/a7ryP13Mx0psfQFsSCCmMGblDBNCuNfCPuIvjcPbVrkcaelMPoR kl7Tf9jFjKmdK5f5+IfipR6qSmIGZ7WwIlNUVMkHkycyDfgtn3EGEdc9uM2ntaw+2KlL /alGfS8gj7zO4wW6M7flfSH99BW8JtY77bXjZ+Y5VBYArnZDsdzKkQYeA5EUDT7AXl/A Jcnw== X-Gm-Message-State: AGi0PuZtfuvCS0oViJWoZdfuWS0Zvwja2BhYdA6ngngX15L5awCGcqZE hAWrlAYYMpRAevSstT6FG6r+wB70Pfg= X-Google-Smtp-Source: APiQypI222TDc/7riljzEcTyOWrUzl0NTTCsUhqcsSQ2EykVwBQyMmHvavDx9bauT0zEG/6MNvtgYA== X-Received: by 2002:a1c:1b58:: with SMTP id b85mr10962459wmb.112.1586642667887; Sat, 11 Apr 2020 15:04:27 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id l26sm305258wrb.7.2020.04.11.15.04.27 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Apr 2020 15:04:27 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, rientjes@google.com, anshuman.khandual@arm.com, david@redhat.com, Wei Yang Subject: [Patch v3 5/5] mm/page_alloc.c: extract check_[new|free]_page_bad() common part to page_bad_reason() Date: Sat, 11 Apr 2020 22:03:57 +0000 Message-Id: <20200411220357.9636-6-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200411220357.9636-1-richard.weiyang@gmail.com> References: <20200411220357.9636-1-richard.weiyang@gmail.com> 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: We share the similar code in check_[new|free]_page_bad() to get the page's bad reason. Let's extract it and reduce code duplication. Signed-off-by: Wei Yang --- mm/page_alloc.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index dfcf2682ed40..c12a5a9b79c8 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1013,7 +1013,7 @@ static inline bool page_expected_state(struct page *page, return true; } -static void check_free_page_bad(struct page *page) +static const char *page_bad_reason(struct page *page, unsigned long flags) { const char *bad_reason = NULL; @@ -1023,13 +1023,23 @@ static void check_free_page_bad(struct page *page) bad_reason = "non-NULL mapping"; if (unlikely(page_ref_count(page) != 0)) bad_reason = "nonzero _refcount"; - if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_FREE)) - bad_reason = "PAGE_FLAGS_CHECK_AT_FREE flag(s) set"; + if (unlikely(page->flags & flags)) { + if (flags == PAGE_FLAGS_CHECK_AT_PREP) + bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag(s) set"; + else + bad_reason = "PAGE_FLAGS_CHECK_AT_FREE flag(s) set"; + } #ifdef CONFIG_MEMCG if (unlikely(page->mem_cgroup)) bad_reason = "page still charged to cgroup"; #endif - bad_page(page, bad_reason); + return bad_reason; +} + +static void check_free_page_bad(struct page *page) +{ + bad_page(page, + page_bad_reason(page, PAGE_FLAGS_CHECK_AT_FREE)); } static inline int check_free_page(struct page *page) @@ -2023,26 +2033,14 @@ static inline void expand(struct zone *zone, struct page *page, static void check_new_page_bad(struct page *page) { - const char *bad_reason = NULL; - if (unlikely(page->flags & __PG_HWPOISON)) { /* Don't complain about hwpoisoned pages */ page_mapcount_reset(page); /* remove PageBuddy */ return; } - if (unlikely(atomic_read(&page->_mapcount) != -1)) - bad_reason = "nonzero mapcount"; - if (unlikely(page->mapping != NULL)) - bad_reason = "non-NULL mapping"; - if (unlikely(page_ref_count(page) != 0)) - bad_reason = "nonzero _refcount"; - if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) - bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; -#ifdef CONFIG_MEMCG - if (unlikely(page->mem_cgroup)) - bad_reason = "page still charged to cgroup"; -#endif - bad_page(page, bad_reason); + + bad_page(page, + page_bad_reason(page, PAGE_FLAGS_CHECK_AT_PREP)); } /*