From patchwork Fri Nov 9 06:47:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 10675365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1280113BF for ; Fri, 9 Nov 2018 06:47:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01F562DD3D for ; Fri, 9 Nov 2018 06:47:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAB892DD51; Fri, 9 Nov 2018 06:47:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 619242DD3D for ; Fri, 9 Nov 2018 06:47:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DED66B0698; Fri, 9 Nov 2018 01:47:38 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 565446B069A; Fri, 9 Nov 2018 01:47:38 -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 3BD956B069B; Fri, 9 Nov 2018 01:47:38 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id E58676B0698 for ; Fri, 9 Nov 2018 01:47:37 -0500 (EST) Received: by mail-pf1-f199.google.com with SMTP id 190-v6so777205pfd.7 for ; Thu, 08 Nov 2018 22:47:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:sender:from:to:cc:subject:date :message-id:in-reply-to:references; bh=I5gsSunXdH895MmsSOVcjAuo3r5POwuiCmdFP97vCrk=; b=Z4mygZ/SpKm85NH7bV1w1VL2a84y35EqWg+zgvdqkkUknnt4ywjv5Uhv1/zQVMW/yz TduiYP93kus58/oPxbW0RhVuWccZ22xcoOG5Ad5tPN2O6Jqrlkb6BooYbIyz0mqkFaxq tAf8YOApoIDg4Wvue0eyC2N5FrtkGUb17YG1kyipJph613VXCkq+T5NB2Vfud1aprzP/ r4jkb/N0SupsJjZwkg+81hF0ZtW+5qF6vhxH0drc4OAlSrXAf1j3pBRtymfu7huRrvti AdK6NwSeW1AqJXR/Z4HaBXKiAPkiWrAwbZyAD9PLmIWODganVSJcOaehmL6lYRSjsvbe d8VA== X-Gm-Message-State: AGRZ1gI/B9QIsd00g/ZfXgywIuje/12g6/wib9ZYm9Y+vAyScx/FirE1 xUOtrL20EVINNlkVVcR2Oiznv+qFg9BlR+odHkQMYWepiZv93+tUrfLVMihFwBEkGv8t7VNugPb imbMPDjRBrtgfxXpwhF8U5qoZT5BuG0a7AqFqi+rLPz/UDqzP2IX0JjTiuqpu5R/y+ASG7wTLAw Cds5ghXq7+AIdQpxqhM7TV2GwR23X5lxncNU9YCmgrrxxG3i62OPObjC94aVly7dcOXlGbIB/UK rADYuflTqEKk8WZiE2MzrHQzU9C4qodjgqxVl7mj/H73y4Mh/ddHHWTp2kz0mtoRqfwun5eybRO A4sLlEujEFUhnOrV/nvEcVG9MinTUbvXCboU0YOugUYVaAJjhLWA0puxa0bYz1YnXmbTFNmG4Q= = X-Received: by 2002:a63:1204:: with SMTP id h4mr6456182pgl.51.1541746057553; Thu, 08 Nov 2018 22:47:37 -0800 (PST) X-Received: by 2002:a63:1204:: with SMTP id h4mr6456140pgl.51.1541746056231; Thu, 08 Nov 2018 22:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541746056; cv=none; d=google.com; s=arc-20160816; b=tJFFyf/A9/1JIqC80gTELoTJ0wWmgtvZCWAMmjq8FZYkq4gtZ8i4E13SzEjNQCN+1a hejfCzLnRFYMki09fispOYAC00TUj4SjUa/XFlffZi9Qw2B/8nkT1TaJ97mUSVThJMxM ewSJJHD76h+zCsz/y5jiSzaxN0M/NXFoxfPxUiv8fQF/MN/urCk+WMCv33F9/t0gsVEp RfNEzo+K9kL5BgondP6IFJR4ISjcWy1ldC9rCHC+UcuocsvxUmCeW0dxow01J7i13kEY UBlN+Qlf+YehteUwuq9+AcO9Hn2wnpMGr0c99ShbJO4d3hnpjSH4p2GuwjTvKhVtCD86 cWQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=I5gsSunXdH895MmsSOVcjAuo3r5POwuiCmdFP97vCrk=; b=O9AOa8yTytV4Lbgs+WBzBqqKNPQ6hjdzkO2huQ9RRfEXlUMGZGPIXbKhz3hAvdjUhr smLEDWDHDwR9W6YIt7MPJVmz4K1BTRNEwjF8j8JpdiQzhEnUdNuHjyRWlOxqwS8LnDYH OfD95+y5Z2bcYISDcIc1DB2Z1agm+sMqdVOD4lnwXT9Wnn4sajbpw6opp/ol5y3xpPqE xAImG+q8RWVdeM04vD9EMLYfnk8rhfca57NJO5gN7UeHSKyc+1U/rBI+zds5L7Nyq4g7 BL6PVk6XYcnIEBuYXkltUjsUAGl845i3xh+oIgQaVktY8L+gxe/w782gieTGiC6elDDy iwOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sdRN1yRf; spf=pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nao.horiguchi@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id j12-v6sor7852419plk.37.2018.11.08.22.47.36 for (Google Transport Security); Thu, 08 Nov 2018 22:47:36 -0800 (PST) Received-SPF: pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sdRN1yRf; spf=pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nao.horiguchi@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=I5gsSunXdH895MmsSOVcjAuo3r5POwuiCmdFP97vCrk=; b=sdRN1yRf9dBJRcb+kLIszEwQGdNQOZ/Cr+T69TTOG33+p7+lHSgokccxp12AmGcVIv b91zsOA4UMyF4L+oVL6LsmtmQ0mrUPXuofZRoGL2SArKd4t78l8//9OXDgx2DByLzwTH bgn+qlrl5d8UAp2EsmA5ST/wxze2XAq74fATX8SIK1LqbWEWaxtnpfmlLifaIrlgvM2T +KVOe7h4t1J6EV679ilKNSH27x7hciLKHKWR36KGpRkR3Y8utPdIl0luWG0Zz028cmxA W3eGSr7QcHdRS1QEaYGPjeykA6PaFyjQ8LBPWvy/4j6IrhNw8DC3u40Jf+I+3hNC3Iu7 QedQ== X-Google-Smtp-Source: AJdET5eg902nQvUWpouttJ+YLnryXSQ9Zt4zI710Y5VxL9S/LDzptvX0L/igyGaFSk4UGTH0C2OnIw== X-Received: by 2002:a17:902:2cc1:: with SMTP id n59-v6mr542277plb.26.1541746055768; Thu, 08 Nov 2018 22:47:35 -0800 (PST) Received: from www9186uo.sakura.ne.jp (www9186uo.sakura.ne.jp. [153.121.56.200]) by smtp.gmail.com with ESMTPSA id c70-v6sm6808355pfg.97.2018.11.08.22.47.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 22:47:35 -0800 (PST) From: Naoya Horiguchi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Michal Hocko , Andrew Morton , Mike Kravetz , xishi.qiuxishi@alibaba-inc.com, Laurent Dufour Subject: [RFC][PATCH v1 03/11] mm: move definition of num_poisoned_pages_inc/dec to include/linux/mm.h Date: Fri, 9 Nov 2018 15:47:07 +0900 Message-Id: <1541746035-13408-4-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1541746035-13408-1-git-send-email-n-horiguchi@ah.jp.nec.com> References: <1541746035-13408-1-git-send-email-n-horiguchi@ah.jp.nec.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: X-Virus-Scanned: ClamAV using ClamSMTP num_poisoned_pages_inc/dec had better be visible to some file like mm/sparse.c and mm/page_alloc.c (for a subsequent patch). So let's move it to include/linux/mm.h. Signed-off-by: Naoya Horiguchi Reviewed-by: Anshuman Khandual --- include/linux/mm.h | 13 ++++++++++++- include/linux/swapops.h | 16 ---------------- mm/sparse.c | 2 +- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git v4.19-mmotm-2018-10-30-16-08/include/linux/mm.h v4.19-mmotm-2018-10-30-16-08_patched/include/linux/mm.h index 59df394..22623ba 100644 --- v4.19-mmotm-2018-10-30-16-08/include/linux/mm.h +++ v4.19-mmotm-2018-10-30-16-08_patched/include/linux/mm.h @@ -2741,7 +2741,7 @@ extern void shake_page(struct page *p, int access); extern atomic_long_t num_poisoned_pages __read_mostly; extern int soft_offline_page(struct page *page, int flags); - +#ifdef CONFIG_MEMORY_FAILURE /* * Error handlers for various types of pages. */ @@ -2777,6 +2777,17 @@ enum mf_action_page_type { MF_MSG_UNKNOWN, }; +static inline void num_poisoned_pages_inc(void) +{ + atomic_long_inc(&num_poisoned_pages); +} + +static inline void num_poisoned_pages_dec(void) +{ + atomic_long_dec(&num_poisoned_pages); +} +#endif + #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS) extern void clear_huge_page(struct page *page, unsigned long addr_hint, diff --git v4.19-mmotm-2018-10-30-16-08/include/linux/swapops.h v4.19-mmotm-2018-10-30-16-08_patched/include/linux/swapops.h index 4d96166..88137e9 100644 --- v4.19-mmotm-2018-10-30-16-08/include/linux/swapops.h +++ v4.19-mmotm-2018-10-30-16-08_patched/include/linux/swapops.h @@ -320,8 +320,6 @@ static inline int is_pmd_migration_entry(pmd_t pmd) #ifdef CONFIG_MEMORY_FAILURE -extern atomic_long_t num_poisoned_pages __read_mostly; - /* * Support for hardware poisoned pages */ @@ -336,16 +334,6 @@ static inline int is_hwpoison_entry(swp_entry_t entry) return swp_type(entry) == SWP_HWPOISON; } -static inline void num_poisoned_pages_inc(void) -{ - atomic_long_inc(&num_poisoned_pages); -} - -static inline void num_poisoned_pages_dec(void) -{ - atomic_long_dec(&num_poisoned_pages); -} - #else static inline swp_entry_t make_hwpoison_entry(struct page *page) @@ -357,10 +345,6 @@ static inline int is_hwpoison_entry(swp_entry_t swp) { return 0; } - -static inline void num_poisoned_pages_inc(void) -{ -} #endif #if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) diff --git v4.19-mmotm-2018-10-30-16-08/mm/sparse.c v4.19-mmotm-2018-10-30-16-08_patched/mm/sparse.c index 33307fc..7ada2e5 100644 --- v4.19-mmotm-2018-10-30-16-08/mm/sparse.c +++ v4.19-mmotm-2018-10-30-16-08_patched/mm/sparse.c @@ -726,7 +726,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) for (i = 0; i < nr_pages; i++) { if (PageHWPoison(&memmap[i])) { - atomic_long_sub(1, &num_poisoned_pages); + num_poisoned_pages_dec(); ClearPageHWPoison(&memmap[i]); } }