Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp840696imm; Fri, 27 Jul 2018 07:05:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpde8PanOlXWnjozo62OM9T0yCn/QZ4NgUmB45kji0mHoLyKRQMEYArLhscApAeeAV7zwura X-Received: by 2002:a63:d704:: with SMTP id d4-v6mr6335453pgg.312.1532700314309; Fri, 27 Jul 2018 07:05:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532700314; cv=none; d=google.com; s=arc-20160816; b=gR/Z7Ip69WeRxLgZSE1vc19vq8vDPqL2KninivCcuYA9LP5lNoqfpaV1VwgBcdzGeL SF8dg3dUnJyr5TkC7GDJ/ei3wyI3qLmN8tWqtt5vkLZsem33ix7cmeCEJnmuZw0JOqXg 5valQAWRhKN0zAUPOK4my4LZ++botTCtv0vzHO8H7z8ak+0s//ZF1p7ycbpyF/BW7t5h FUcweU8gjuip9yEcAns+t1t7Dw/6G0CowYCn48jSxf287mQXYAFlI9Zb3iv7isL6AdQw 6Z6Mi0QyajTuFKesyHGDnFBTmC9MembzgLXPbcUD4z0fG65q4OMTYG8lus3T2a/U0tHl 3pRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=09jE8HQnR78gKgCVm3YT0g0xgTev+DzLs5mljNQWB3Y=; b=tE+8G2o5X+6E5j9PZXK1Fak65bWpQE8W1WQ5I5ombwDziaXMXL1sEQJnprWpEaGeDC Zltddu2ohCL4CL+iHz5XU4dlBDBM63RqaHPqHgoUUm7EgLIQVAfB8e+57zYkzmendECf G8FmNAPsWfpcW5I3+MwU/iHh7iIW4WKX5kVMgn0nA8oCyPZvKVqCTWvlFRtFFzfV8C2f 0uxmqg76E3TAfdVTOlPIYgM4jI4tNQu+e9qDwpMzBsX0ZgHy4Af923E405g7QtQUpmgY 0NY50iqxLTGhrJmqFco60pLue14OXgxS3kHfg8zjXV43kAXy/7Mta7Rovx3prw/CUobf +0cA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3-v6si3472697pln.250.2018.07.27.07.04.59; Fri, 27 Jul 2018 07:05:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388663AbeG0PZk (ORCPT + 99 others); Fri, 27 Jul 2018 11:25:40 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:39476 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730737AbeG0PZj (ORCPT ); Fri, 27 Jul 2018 11:25:39 -0400 Received: by mail-wm0-f66.google.com with SMTP id h20-v6so5562391wmb.4 for ; Fri, 27 Jul 2018 07:03:34 -0700 (PDT) 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=09jE8HQnR78gKgCVm3YT0g0xgTev+DzLs5mljNQWB3Y=; b=ihcYnS1suULwWfgCKkinKiCgoJiMBZo6c+ksG+8TYfjHGDZm65WtCzY+pDTbTQUrAq z5RLOwhHDk/m8LoSkWZr/aeTyT0BxBOhrqe/XMP/7J751CijKstGFsxY9D8l1FScBvBZ vH8B7Tr5EqlXazKuCJy6C/BRQOOOjvf4+NNV8bT/ML3iK5ut269gLquz+eST6cswvsxw ljz6QmhtmGcyfwI+XxzDOPpwXKODXT2llRGuRvV9GyXAV5lJIYT4y2FoeMnzW5hdBpjK crTvYpnEWQwcqt1jDdlIDkAI6d9Av8wUuNlKHKP2q7+8SmSydzJ2cnb90txhLfntrJEn 6b+g== X-Gm-Message-State: AOUpUlFfmFKA6MVY94J5TpitVZBLkn/wnnnbFrd5NgDoEQhzwHbZpJOm ygvZ3fTL/LFFo+xGHi4Iois= X-Received: by 2002:a1c:9215:: with SMTP id u21-v6mr4315769wmd.106.1532700213727; Fri, 27 Jul 2018 07:03:33 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id n17-v6sm3453450wmc.13.2018.07.27.07.03.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 07:03:32 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 71EC5124405; Fri, 27 Jul 2018 16:03:31 +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, Oscar Salvador Subject: [PATCH v4 1/4] mm/page_alloc: Move ifdefery out of free_area_init_core Date: Fri, 27 Jul 2018 16:03:22 +0200 Message-Id: <20180727140325.11881-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180727140325.11881-1-osalvador@techadventures.net> References: <20180727140325.11881-1-osalvador@techadventures.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 e357189cd24a..8a73305f7c55 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6206,6 +6206,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 @@ -6220,21 +6251,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)); -- 2.13.6