From patchwork Fri Sep 18 03:00:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11783935 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 0946F59D for ; Fri, 18 Sep 2020 03:01:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BF9AC206B6 for ; Fri, 18 Sep 2020 03:01:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="qy3asCDa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF9AC206B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E89D900005; Thu, 17 Sep 2020 23:01:14 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 54DAA8E0001; Thu, 17 Sep 2020 23:01:14 -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 3C8AA900005; Thu, 17 Sep 2020 23:01:14 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 1D3098E0001 for ; Thu, 17 Sep 2020 23:01:14 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DD4D4181AEF1F for ; Fri, 18 Sep 2020 03:01:13 +0000 (UTC) X-FDA: 77274680826.19.tramp67_2714f1e27127 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id B1DB71AD1B5 for ; Fri, 18 Sep 2020 03:01:13 +0000 (UTC) X-Spam-Summary: 1,0,0,3682e093dac72313,d41d8cd98f00b204,3-cjkxwykcm8jfk2v919916z.x97638fi-775gvx5.9c1@flex--yuzhao.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2898:3138:3139:3140:3141:3142:3152:3352:3865:3867:3868:3874:4321:4605:5007:6261:6653:6742:8957:9010:9969:10004:10400:11026:11232:11473:11658:11914:12043:12296:12297:12438:12555:12895:12986:14096:14097:14181:14394:14659:14721:21080:21444:21627:21987:21990:30054:30070,0,RBL:209.85.160.201:@flex--yuzhao.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04yrbpaqh3wsnazoe1ryrkmu75cryypeq3ykwc6jx4m77r37ydn6yr1xokyoq4g.b1qxc5kgbat76x6h16bnok613inaeqy1jn9zb98t8hc1degx89g4rprn5u8o8ac.c-lbl8.mailshell.net-223.238.255.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:22,LUA_SUMMARY:none X-HE-Tag: tramp67_2714f1e27127 X-Filterd-Recvd-Size: 5621 Received: from mail-qt1-f201.google.com (mail-qt1-f201.google.com [209.85.160.201]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 03:01:13 +0000 (UTC) Received: by mail-qt1-f201.google.com with SMTP id b18so3823805qto.4 for ; Thu, 17 Sep 2020 20:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=JWU8yC6IA7OOmAjcclmLYHeJJ6Drguj19pPsyjDCDs0=; b=qy3asCDaCFhH2UckwoVpj1hLkwKFWdJ8Q5ketDmhYI3hL6mTuFwQvIqRDiOthDLcop PaTh5jl3tn3RExOoer2eQ1sA4CtBHf8RusyChtv3D0k48TiFbyxIhJyEXtCqHq/0n1xE 3Yn8oq0MtIy5PWoW+p1Bq2LKE228TMBHdm2Q2e3ocu7wJuESMOzDPfmS1X2MYwdMtH0N /lhTVZtJPDrrqCIwW+Ymnxtxhor8zWXlnCdwoOxR8+e1hPcZXo/+sihZSJUl+SblRMo0 nvdn+vCO4zY56L7FbvQlWb3v1qy4rUB83yS9VcoBBSfFkDeCenHZoAYK3FFf8xrMjl6h SWWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=JWU8yC6IA7OOmAjcclmLYHeJJ6Drguj19pPsyjDCDs0=; b=eYf5b9j5rKUd86YKX1hArgaTGobV9rLTHLM+TEEOoI/qXTya987B8ijVd4/yGFt6rC x8weP+zKLLZyHIgrIM4lH705DSFdPhZ4kErGjLgt4l6ZiHxmMZCsHi1uhkcmw/BR8VSc dIkPaK5hjg+HrbGzoSWI/zVjQDBO7Y9ZiosEKHnWz+63/nPwde+rV/e8eFOo/W+GtQeh U5W4B4vZtntj17P8b6R+uXDWz7+hIAbAytkNv8uqOmmioBK0T/VIXasMqi9SUCFb4Hwb Rap/392Xlvck9ZMrEcoZ/O1gcbCdSRn5utNla7caGGdIjANb50+VgyyTvsrDD+bSYw2c 9ESg== X-Gm-Message-State: AOAM5323bese1hSq5+KE60c8Nsa0IYPMFwcSDpujcSMfzprZQrL3U40I rWvCD4vuLTzPk1tIqo/ABDPDjaSFIlk= X-Google-Smtp-Source: ABdhPJxIHy/OXzjFuCpoj0u7VNt7iPcltg3BNZV0oXGBDUKbZUUYLhQqY4UiUR7CtG/Lm+IdXuWI6R/A+ec= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:7220:84ff:fe09:2d90]) (user=yuzhao job=sendgmr) by 2002:ad4:5745:: with SMTP id q5mr31480391qvx.29.1600398072647; Thu, 17 Sep 2020 20:01:12 -0700 (PDT) Date: Thu, 17 Sep 2020 21:00:48 -0600 In-Reply-To: <20200918030051.650890-1-yuzhao@google.com> Message-Id: <20200918030051.650890-11-yuzhao@google.com> Mime-Version: 1.0 References: <20200918030051.650890-1-yuzhao@google.com> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH 10/13] mm: VM_BUG_ON lru page flags From: Yu Zhao To: Andrew Morton , Michal Hocko Cc: Alex Shi , Steven Rostedt , Ingo Molnar , Johannes Weiner , Vladimir Davydov , Roman Gushchin , Shakeel Butt , Chris Down , Yafang Shao , Vlastimil Babka , Huang Ying , Pankaj Gupta , Matthew Wilcox , Konstantin Khlebnikov , Minchan Kim , Jaewon Kim , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao 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: Move scattered VM_BUG_ONs to two essential places that cover all lru list additions and deletions. Signed-off-by: Yu Zhao --- include/linux/mm_inline.h | 4 ++++ mm/swap.c | 2 -- mm/vmscan.c | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 07d9a0286635..7183c7a03f09 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -51,6 +51,8 @@ static __always_inline void update_lru_size(struct lruvec *lruvec, */ static __always_inline void __clear_page_lru_flags(struct page *page) { + VM_BUG_ON_PAGE(!PageLRU(page), page); + __ClearPageLRU(page); /* this shouldn't happen, so leave the flags to bad_page() */ @@ -72,6 +74,8 @@ static __always_inline enum lru_list page_lru(struct page *page) { enum lru_list lru; + VM_BUG_ON_PAGE(PageActive(page) && PageUnevictable(page), page); + if (PageUnevictable(page)) return LRU_UNEVICTABLE; diff --git a/mm/swap.c b/mm/swap.c index b252f3593c57..4daa46907dd5 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -85,7 +85,6 @@ static void __page_cache_release(struct page *page) spin_lock_irqsave(&pgdat->lru_lock, flags); lruvec = mem_cgroup_page_lruvec(page, pgdat); - VM_BUG_ON_PAGE(!PageLRU(page), page); del_page_from_lru_list(page, lruvec); __clear_page_lru_flags(page); spin_unlock_irqrestore(&pgdat->lru_lock, flags); @@ -885,7 +884,6 @@ void release_pages(struct page **pages, int nr) } lruvec = mem_cgroup_page_lruvec(page, locked_pgdat); - VM_BUG_ON_PAGE(!PageLRU(page), page); del_page_from_lru_list(page, lruvec); __clear_page_lru_flags(page); } diff --git a/mm/vmscan.c b/mm/vmscan.c index d93033407200..4688e495c242 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4276,7 +4276,6 @@ void check_move_unevictable_pages(struct pagevec *pvec) continue; if (page_evictable(page)) { - VM_BUG_ON_PAGE(PageActive(page), page); del_page_from_lru_list(page, lruvec); ClearPageUnevictable(page); add_page_to_lru_list(page, lruvec);