From patchwork Wed Aug 1 12:23:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10552221 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 D302113B8 for ; Wed, 1 Aug 2018 12:24:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB1872AB72 for ; Wed, 1 Aug 2018 12:24:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEA772AB8A; Wed, 1 Aug 2018 12:24:01 +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.9 required=2.0 tests=BAYES_00,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 42E982AB72 for ; Wed, 1 Aug 2018 12:24:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC0016B026A; Wed, 1 Aug 2018 08:23:59 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DD16D6B0006; Wed, 1 Aug 2018 08:23:59 -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 C27C36B0266; Wed, 1 Aug 2018 08:23:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by kanga.kvack.org (Postfix) with ESMTP id 643F96B0005 for ; Wed, 1 Aug 2018 08:23:59 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id p3-v6so3585800wmc.7 for ; Wed, 01 Aug 2018 05:23:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=D64Mkwf8KbDFNcAAymsFtzvDXY06XAPrzkCh16O3amM=; b=ghRx/ivrFKYjCFLKNFT6rQv6tJM3pIv7nV3Ki/M8K+5mutAVf1EX/o5WlqzulcrYWw zCY3Rky9tp5eYNE5y1Qop4nHScSZhrIRhASDMRa0ur9GFBGbVNaw73DhT/jpGsw3p/i4 k/AlMkmfIjwW2jKbZzprZ0CojYWkIYfBeNsvxkBPlHw1HxIuPO8iKI8c204X0JmCRlsV kfuSDeXQ/CjGIvivw1SqUxbK7N2y7z+xIXUnrz1kRz3Q/upAAPQ6gprh+HGWADMp7wjZ eFWqAm1QBK22Pme2twjy9MF3MP7r+P0Ugk6wQCOk00mp8YPu1ROyFNpDF2n/ikUB/xGC Nx9w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Gm-Message-State: AOUpUlFpKyMzTcIFac1WtXq/iK1iV2b6xmGhKeDcZ51IRxOujpnefw/v /sJPMO54BVomgvOcb6yl8WM31Tg/Jzwph//VLnUq1sWhiu2+Zk50HiBrIimAT6cW3G/jNPqlqcN ZoHysEHzHCbJ0qU82xkPtgziy1lEvTUjTr7eDA0/Oia4ITVBiiLNjemWZ6sIfND8WzmmmPehPCm ut3mTjYElV21XcPowFRdr3qoGRgYWHIvy0Z9LjXq6Mf4upxD/tA5fXQiz8xbqwMaUrYH2EqS3SZ /WvVv6ZNYqa4Fi5QJZelIMFuZIjD00J37IFsSvexoofKS+4TodZ+UzGiVRN8pdPLE62tObZ7Pr3 dXTsQgEexUBquIcl6+UwjMsjVOL2KP3WszU3CeLimKvkNz4NTLI4ArKtaOVAJ1IMyZNHJToCbA= = X-Received: by 2002:adf:e3c5:: with SMTP id k5-v6mr24627849wrm.94.1533126238972; Wed, 01 Aug 2018 05:23:58 -0700 (PDT) X-Received: by 2002:adf:e3c5:: with SMTP id k5-v6mr24627785wrm.94.1533126236841; Wed, 01 Aug 2018 05:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533126236; cv=none; d=google.com; s=arc-20160816; b=jLs4ArBFvoWpmorDT7u6X4dTbvU5B3IWP2Oe2IBnxgUrwwv4bY8YzwNbzomd+Ef0+0 mh9fsLemves/RfucJvOtJQBA8HkbjFkb+kTdhhXHDI4eiCerc1/NS1RoGhvSoMP4LEEG Aj2N1CNwtT3aLaU/YW0QA/LCib8SWjfTnCtCmz3NxhhukmyOKaIWaiXbSQYkCQW6hJ4/ SRaykm4W/N7vGQqvzsqyzlvEMyzhEQmc0X+Qsr9K/veFYCnETAGHLDRQOpwHtpc6xMh5 CRIcop+sg85QsCfi6kRKDXuAjk9IuIm/fxBPxzqhOL55BVZqMtsZxRgF0EqtWW7nxirC ITew== 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 :arc-authentication-results; bh=D64Mkwf8KbDFNcAAymsFtzvDXY06XAPrzkCh16O3amM=; b=UyYPTDoYT8lh3F7dKoKxOdCpo8iNxljoEEk7h13JvS5sKD5YsBS1r6JQRfo+k+9SKz byT5aOrbG3NcbyqhRLkb6azAfq8U3HXnjfrzI9NF+J3OIkGn/keaOvatNnWpwjumK9ii E45q1iKt+GxRLV0p2TeeeGqR/eP33+kJHuBC4HWvC7pQcJMnu2zyKf5kacBK+m5zP4us CscLUpp+qCAxT6FI2FrL6CpHDktnNGDzr8v0QVoRI+yfHv+M1NkLDo/ESBlEazAYm8tc HhFvQ3bMhQQmahIwFi4kU32bJaip1HDekutUzxF1VRg4SvLAxiVLhqs03+wN6yuKakHx M7kQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@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 s4-v6sor7359511wrp.65.2018.08.01.05.23.56 for (Google Transport Security); Wed, 01 Aug 2018 05:23:56 -0700 (PDT) Received-SPF: pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Google-Smtp-Source: AAOMgpdjFDxaWWdeTyt7e+4z4+awOFIx6ROpYIPfHwG64sOC/bXlHEdM2SQz1BeK8g3QD34PLwHdIw== X-Received: by 2002:adf:a541:: with SMTP id j1-v6mr25580112wrb.155.1533126236593; Wed, 01 Aug 2018 05:23:56 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id d42-v6sm2445508wma.0.2018.08.01.05.23.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 05:23:56 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id B222712453F; Wed, 1 Aug 2018 14:23:54 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: mhocko@suse.com, vbabka@suse.cz, pasha.tatashin@oracle.com, mgorman@techsingularity.net, aaron.lu@intel.com, iamjoonsoo.kim@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dan.j.williams@intel.com, david@redhat.com, Oscar Salvador Subject: [PATCH v6 1/5] mm/page_alloc: Move ifdefery out of free_area_init_core Date: Wed, 1 Aug 2018 14:23:44 +0200 Message-Id: <20180801122348.21588-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180801122348.21588-1-osalvador@techadventures.net> References: <20180801122348.21588-1-osalvador@techadventures.net> 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 From: Oscar Salvador Moving the #ifdefs out of the function makes it easier to follow. Signed-off-by: Oscar Salvador Acked-by: Michal Hocko Reviewed-by: Pavel Tatashin Acked-by: Vlastimil Babka --- mm/page_alloc.c | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 02e4b84038f8..f5e36713c5d4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6196,6 +6196,37 @@ static unsigned long __paginginit calc_memmap_size(unsigned long spanned_pages, return PAGE_ALIGN(pages * sizeof(struct page)) >> PAGE_SHIFT; } +#ifdef CONFIG_NUMA_BALANCING +static void pgdat_init_numabalancing(struct pglist_data *pgdat) +{ + spin_lock_init(&pgdat->numabalancing_migrate_lock); + pgdat->numabalancing_migrate_nr_pages = 0; + pgdat->numabalancing_migrate_next_window = jiffies; +} +#else +static void pgdat_init_numabalancing(struct pglist_data *pgdat) {} +#endif + +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static void pgdat_init_split_queue(struct pglist_data *pgdat) +{ + spin_lock_init(&pgdat->split_queue_lock); + INIT_LIST_HEAD(&pgdat->split_queue); + pgdat->split_queue_len = 0; +} +#else +static void pgdat_init_split_queue(struct pglist_data *pgdat) {} +#endif + +#ifdef CONFIG_COMPACTION +static void pgdat_init_kcompactd(struct pglist_data *pgdat) +{ + init_waitqueue_head(&pgdat->kcompactd_wait); +} +#else +static void pgdat_init_kcompactd(struct pglist_data *pgdat) {} +#endif + /* * Set up the zone data structures: * - mark all pages reserved @@ -6210,21 +6241,14 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat) int nid = pgdat->node_id; pgdat_resize_init(pgdat); -#ifdef CONFIG_NUMA_BALANCING - spin_lock_init(&pgdat->numabalancing_migrate_lock); - pgdat->numabalancing_migrate_nr_pages = 0; - pgdat->numabalancing_migrate_next_window = jiffies; -#endif -#ifdef CONFIG_TRANSPARENT_HUGEPAGE - spin_lock_init(&pgdat->split_queue_lock); - INIT_LIST_HEAD(&pgdat->split_queue); - pgdat->split_queue_len = 0; -#endif + + pgdat_init_numabalancing(pgdat); + pgdat_init_split_queue(pgdat); + pgdat_init_kcompactd(pgdat); + init_waitqueue_head(&pgdat->kswapd_wait); init_waitqueue_head(&pgdat->pfmemalloc_wait); -#ifdef CONFIG_COMPACTION - init_waitqueue_head(&pgdat->kcompactd_wait); -#endif + pgdat_page_ext_init(pgdat); spin_lock_init(&pgdat->lru_lock); lruvec_init(node_lruvec(pgdat));