From patchwork Thu Jul 19 13:27:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10534409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 79E8F600F4 for ; Thu, 19 Jul 2018 13:27:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61DD5298CC for ; Thu, 19 Jul 2018 13:27:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56396298D7; Thu, 19 Jul 2018 13:27:51 +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 E0E17298CC for ; Thu, 19 Jul 2018 13:27:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5A586B0269; Thu, 19 Jul 2018 09:27:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C0E596B026A; Thu, 19 Jul 2018 09:27:48 -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 A5F006B026B; Thu, 19 Jul 2018 09:27:48 -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 42BC16B0269 for ; Thu, 19 Jul 2018 09:27:48 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id v24-v6so2360123wmh.5 for ; Thu, 19 Jul 2018 06:27:48 -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=09jE8HQnR78gKgCVm3YT0g0xgTev+DzLs5mljNQWB3Y=; b=Xv2sxlSRIvdc65skmer04xLorVIM/IqEyzcdZP9najq78QEkivsbIAKUFamF9N3Dui EC7SuKJjHjBMV1AHQPvk5zHP3kQnWwTNLgtYcyXmgeSoUhInMKf4jg4bXXwOZDMIMdf2 BQP93IW7I0hdWPRmetgBWEWgSBFRBdLKjwwzoULFio13BvSx2UkIZzLlfb61lDSNVD4Y iXep2NGIiIqYSqJL2IKpMubPiX5OrfMBzhYfqX5inSxSU6KicYKXgcJxWYpGH2Ga7L04 yznIED7hbYPw7Zok+plpR350FZzIGpWybc3QrrvYhimJ5RX2Qn/L1JiPISnHu4iiEPIJ IRWw== 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: AOUpUlEy7uMPMG+P7bybrrL2UZ7h9pYs6tCBGAE76aCqc+JPeoUGlFmd 7/koh7QFQJrIKOcRxEqd/xkMfMMqT5nTOoO9ojmaDdGPK87+a3lRYdC6VQJzO0X78pztvHjwJMK ptk0mdzKiqyiw22gvlm6OwJnAOq2Ik3cD7UD4lBHfjY0HVpXam7k7CGrdQji1BluNw+eWceozDa CmU2CV4NHu+WZjwrkKfov3DHGtkTCA+g9iuF02o0hl52s3FIpyimO3+iJjExPxXOCRjXuSyWj5I RBac7toZnCtEvbQWgeyQiOQEuGbOo8MoeR499296iDywmkqe6pBdtLlnnQmoQxyOc9+hVDk0UWg 8aGWYjqO21UWO8X1GHlFubk6VGQjnviw47TboOkuFgETQrzhVPGEHVlX0NFXBtllKPVmTwfnww= = X-Received: by 2002:adf:8481:: with SMTP id 1-v6mr7817049wrg.34.1532006867848; Thu, 19 Jul 2018 06:27:47 -0700 (PDT) X-Received: by 2002:adf:8481:: with SMTP id 1-v6mr7816998wrg.34.1532006867122; Thu, 19 Jul 2018 06:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532006867; cv=none; d=google.com; s=arc-20160816; b=hQ0tj66C3onZYMx7Ls+pkc9uNpwSn071KbjWc3hspfRPjzvdvV5u8NEWxVzXSLZf93 zUlNElINZG+i2+e5lXXQdjrDDb3JrZHGZFFnID8FkLNqrm0iTciWPjzpXtA/f7aMnyhY j57ZzRrjHVmqna2lIlkAvTI5ShGPb2rTvm8+KUUieN0h3Lh2780F45Q9Zd8xW78miijN F3Sck5y24kZMe4cojgpBTquQMVQTNrm2wDPcacIO/hQA1ask0QWlH1HDFW4DVFiZ1nqe samB9Bv+FIfsBONkkKSEU+YVFkEV35Fe7xpxHO+EIceGxM+EVuxZ1U/UfB2xqFJTApAq rRkw== 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=09jE8HQnR78gKgCVm3YT0g0xgTev+DzLs5mljNQWB3Y=; b=Q+C243J0F06HxkBquCPXv9/ar4m6cKf9XBniqmPK0TOgsUQcCUBPLBprDmqO5E2f3d f8q+LiAglIW0cIDXiXCNNs/mwxs+HL4Io7zHRvp5ph0OHRPPzyTVcaBjkHRMortNN94R O+01Ofp7aw8+gf6vzfAW1MCOIGoF4fClPxG/v0ify2cK/wujyIaisCjYIkOsX54UdVba DCazO3XS+IG6Gvqg6n7NHqV4eMC0fenHXQ8iyUI18zmGOpR+A24BC2AqvwUwVrsev3Sh ZHlaeDFxflH8MoQVWRPk880QyZd23hwP45+d3paMbl1gcVqNqGj4pznT39It1u24V0C7 8xPw== 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 g144-v6sor1189304wmg.51.2018.07.19.06.27.46 for (Google Transport Security); Thu, 19 Jul 2018 06:27:47 -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: AAOMgpcLI/x+/PnAxW11n/FXucBZLi1hFGU/bOkg9GLfJBGYWFrIcRvkVxDQVHal7zazLzHlaJf5UA== X-Received: by 2002:a1c:2142:: with SMTP id h63-v6mr4418221wmh.51.1532006866682; Thu, 19 Jul 2018 06:27:46 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id g10-v6sm8210140wru.43.2018.07.19.06.27.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 06:27:45 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id B28AA124172; Thu, 19 Jul 2018 15:27:44 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: pasha.tatashin@oracle.com, mhocko@suse.com, vbabka@suse.cz, aaron.lu@intel.com, iamjoonsoo.kim@lge.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Oscar Salvador Subject: [PATCH v2 1/5] mm/page_alloc: Move ifdefery out of free_area_init_core Date: Thu, 19 Jul 2018 15:27:36 +0200 Message-Id: <20180719132740.32743-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180719132740.32743-1-osalvador@techadventures.net> References: <20180719132740.32743-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 --- 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));