From patchwork Fri Nov 15 03:18:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Xinhai X-Patchwork-Id: 11244733 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 3BDB21393 for ; Fri, 15 Nov 2019 03:19:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F1870206F4 for ; Fri, 15 Nov 2019 03:19:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K45GQSKM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1870206F4 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 354A96B0005; Thu, 14 Nov 2019 22:19:06 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3052A6B0006; Thu, 14 Nov 2019 22:19:06 -0500 (EST) 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 2429C6B0007; Thu, 14 Nov 2019 22:19:06 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 05FE36B0005 for ; Thu, 14 Nov 2019 22:19:06 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id A15C2181AEF07 for ; Fri, 15 Nov 2019 03:19:05 +0000 (UTC) X-FDA: 76157055450.20.skate53_898f91365a946 X-Spam-Summary: 2,0,0,fffda9be281c65ec,d41d8cd98f00b204,lixinhai.lxh@gmail.com,::akpm@linux-foundation.org:mhocko@suse.com,RULES_HIT:41:355:379:541:800:960:967:973:988:989:1260:1345:1431:1437:1534:1541:1711:1730:1747:1777:1792:2393:2525:2559:2563:2682:2685:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3865:3867:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6261:6653:7514:8957:9025:9413:10004:11026:11473:11658:11914:12043:12297:12517:12519:12555:12679:12895:12986:13069:13221:13229:13311:13357:13845:14096:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:21749:21811:30054:30064:30070,0,RBL:error,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:26,LUA_SUMMARY:none X-HE-Tag: skate53_898f91365a946 X-Filterd-Recvd-Size: 3770 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 Nov 2019 03:19:05 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id r18so5051041pgu.13 for ; Thu, 14 Nov 2019 19:19:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/TF7+Zam/bLZOsY3nQXaR5XinJXim+a/AyCSwr6eS1U=; b=K45GQSKMG7lpDXcedUbumZ7d4v1OpOi3Dr9DwV7liS6LLbdJHaihE7z1Idyuhys9BV TVFwZwHatOi11vDPZjWN0bnsWtO4+YoDOmWQT1jC37S0MYbJYiYxS/iMx5DnVCcTlTsB nuZTp/zTmIga0ieuLweAXpOHOdVYsmiEJ8vRKuVx64Tckxuj+22vUWMe/ARi0d70fhf3 L6Yb6XbT2nwUSFtaQtTKa3tDry1U29VncTT5tvkoHjD+SOmU0SnxTwvbkPZIY8YifqhX NX+GcCnIcLuJySGhKpDPXcT1QKceV3sBXqn8Q84FQfJNfYneFA3zOAU9PPeyiE1MsoL+ +hdw== 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; bh=/TF7+Zam/bLZOsY3nQXaR5XinJXim+a/AyCSwr6eS1U=; b=VA4LP6RiQccrZzKyj/zs+XI12Dqysfh8KVvZ95Q46/6m2ERzxBNcpiUJnZDdzKrO79 r7FNx09QRdwu19Dv9zC5xoWStY+XqVkqp3eQNkMF2BQqGxrLKro6Ax7bAe8/ApokUs7U 5fFiUfCGOuZLRnVRXmQ2HbCayY7fjj9LZC8oZfOKmZqtwneACQEqOZD7qC+lEa7NxQ4o iqbPsnz9cYOpqL6pUiBVps0Bqrh20/zvbJqfAtpEMmFG5GJDkzOcqfuBZJtXqdlhBwLy dl+VuJzcrt17mpFlfkFaaS0BMJ8MAOel8SRz7feGBkwZy1iW63XL04aE3OWwcOoj3HUF oCCA== X-Gm-Message-State: APjAAAVO4FB8+ro7LlIG0CQkB60DdU39ZPQ66uVvHKlKAFGCbSD9vjfV LsITTSrue1NJsXgG8AFAG6hDuGoR X-Google-Smtp-Source: APXvYqxtocl7TaiiH/Lhl8O8076SZ2ohFeqcejIW+SJZER63C0K51CuwSnTOz1ZpuxGkT7l/WUgw+Q== X-Received: by 2002:a63:715d:: with SMTP id b29mr13692556pgn.369.1573787943681; Thu, 14 Nov 2019 19:19:03 -0800 (PST) Received: from binjiang-hz-dhcp091254.china.nsn-net.net ([131.228.2.20]) by smtp.gmail.com with ESMTPSA id c3sm7857432pfi.91.2019.11.14.19.18.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 19:19:02 -0800 (PST) From: Li Xinhai To: linux-mm@kvack.org Cc: Andrew Morton , Michal Hocko Subject: [PATCH] mm: Improve PageAnon() to check the whole PAGE_MAPPING_FLAGS Date: Fri, 15 Nov 2019 11:18:23 +0800 Message-Id: <1573787903-2023-1-git-send-email-lixinhai.lxh@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000090, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: PageAnon() just checking on PAGE_MAPPING_ANON bit would cause page, with PageKsm as true, been wrongly considered as PageAnon. Now, checking the whole PAGE_MAPPING_FLAGS to avoid this error. Reported from: https://lore.kernel.org/linux-mm/20191113000651.20677-1-rcampbell@nvidia.com/ Reported-by: Ralph Campbell Cc: Andrew Morton Cc: Michal Hocko Signed-off-by: Li Xinhai --- include/linux/page-flags.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 1bf83c8..1849fc3 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -461,7 +461,8 @@ static __always_inline int PageMappingFlags(struct page *page) static __always_inline int PageAnon(struct page *page) { page = compound_head(page); - return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; + return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) == + PAGE_MAPPING_ANON; } static __always_inline int __PageMovable(struct page *page)