From patchwork Mon Jul 30 13:37:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10549089 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 3067714E0 for ; Mon, 30 Jul 2018 13:37:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E92529971 for ; Mon, 30 Jul 2018 13:37:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 123D029B40; Mon, 30 Jul 2018 13:37:36 +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 73FA729971 for ; Mon, 30 Jul 2018 13:37:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 917A46B000D; Mon, 30 Jul 2018 09:37:34 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8C5886B000E; Mon, 30 Jul 2018 09:37:34 -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 7B6676B0010; Mon, 30 Jul 2018 09:37:34 -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 1CDB36B000D for ; Mon, 30 Jul 2018 09:37:34 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id f11-v6so8001773wmc.3 for ; Mon, 30 Jul 2018 06:37:34 -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; bh=fkCL6JOtZhrngp0JXekbTmOa1tN3kWSPglBG2L6jMLs=; b=MXCD2XfHxRxikmnlQEowucDJRKMeUEOd/uILqVRw8bgm03+V7e8AY/fyJEV/87Q3HT RrY6T73KxAO0yjl5JzejCT2cVUi5rWXUhCCx7SFP49Wg9rZFBzLaL6l2Yd3R+nsmCIxD JOPYk5YQNd2jNgOQuZYzCWhCId9b+IL45Fr3OTnmZ3uhjwc0p5AND7q01bhN7ynRdePZ N4u08uoWeqwY2tl7vJTZ+4nH7OzTX1U5STTptN+TEJbbKX3oFFi+0xxKX4109vU8LU3N hzOg4cXrDxGL8pPNXma4mTObSbPqt6Q9uEkVDqdrXu+lItZy9hcz6AaEiHGXN1hSa45D 3FnQ== 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: AOUpUlHwOUEH3diQqfW4YLYSUQMDnTkLsa3BEHMKHQzbmGFauTlAz1Ky uj+/RtZ2iuRqnZSVAePX4LrnlDCmPDM3qz6NscXx95mNTFnDQkyk9VfpHxyjwkra9yeYF6Eqwsr Jcb6srjm+6xhM8GhJbYPDRw8ZNGcP6Dk6IVPPZWYfYdbikMpq/r9Zam0sEgY5kl6TjvhJn2bjja 0ezlP9+z074N4KvX+lOW1RoCw8AxoXfWdnxl+XwcjJ6OTZlpglh+vj9Rq3+Az9pEdWmv3ECT3Qy bOna/1ZMmGqJ4skRi98c3nihSKPjhSMmIrCAom/Mu69aZ9JO7I4GonGAtuHg3C7l7oVDEm9wzRM s6x/uyHBIC4Pr+Jrmrhodk7aEPsLdEd455OLKLWH8TmWFxMIz71hDb2Us7ifA6rre7Hit7mO1A= = X-Received: by 2002:adf:f585:: with SMTP id f5-v6mr14242385wro.59.1532957853660; Mon, 30 Jul 2018 06:37:33 -0700 (PDT) X-Received: by 2002:adf:f585:: with SMTP id f5-v6mr14242360wro.59.1532957853033; Mon, 30 Jul 2018 06:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532957853; cv=none; d=google.com; s=arc-20160816; b=evNeixzgPbQzxJpVPSH8VmpWZDtFWB/asf2DMJTkXQB/UTZqrPBP/REYdBoJIBw5PD bvn/WJdwkekv7e7tQHudd0cEYBBXoN8kYI0fY/O3CXCGDnT7vyICLzYewV/s/rfFovML gYR3gSQaaAczATqZ8rRBEfeY7rsW+GZne3JWZB5wmABGEO6Qk+fYKsmh1hF+sTKbKvI+ rayJ13BMLIsmeM7BnSGbj+HWY+Dw4MahjJ7jO+hS3wNXG3xhbAM/XvkfXBpTbJ2xZMJv GrBIiBgPohwuD4+wThj1824fJUU40sqwgJf11459584GTOglb6QQ83deHj7OldaZJmdG OUJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=fkCL6JOtZhrngp0JXekbTmOa1tN3kWSPglBG2L6jMLs=; b=QW7qQO8OtFFuUlietqxmizYiOAfG2seH9ut8vwiDtLMJ9FteOKNjrUgsdzruu4ItQE 9xlOZkzjHlj02m6eGgo68QyVTnsKzJW4HtfqF5FEq1167DkUGJGsfGNKNT4okaPmQ7US G5499gNnfUdEl0Sr/9OeVcIoMpWz76dowhshRoFx6Fqm6XOI1j01VYiYQgIpWflwjIoQ ZeBcuzQ5eQfmv9uhPHA9/yrgDfKBVBk5gB1ha/ru4Q7XjUgYDGckebN8BWr5po0ppetD aLVv+v2HMFXiCusrdYau4xnVSgBzguhl930L93tX0dXbPB1JQmCBoMG812vMhugnNj+u 67Eg== 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 l17-v6sor1447299wmd.84.2018.07.30.06.37.32 for (Google Transport Security); Mon, 30 Jul 2018 06:37:32 -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: AAOMgpePZ8qLBEX5z+bGz6RB3lKwyyYcDglnY32XamC3REtuAWK+g3gndyxSXvatmgTjz1VyaLamPg== X-Received: by 2002:a1c:93d3:: with SMTP id v202-v6mr15507084wmd.57.1532957852659; Mon, 30 Jul 2018 06:37:32 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id v130-v6sm15047532wme.13.2018.07.30.06.37.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 06:37:32 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 35CB112440E; Mon, 30 Jul 2018 15:37:31 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: mhocko@suse.com, vbabka@suse.cz, sfr@canb.auug.org.au, rientjes@google.com, pasha.tatashin@oracle.com, kemi.wang@intel.com, jia.he@hxt-semitech.com, ptesarik@suse.com, aryabinin@virtuozzo.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dan.j.williams@intel.com, Oscar Salvador Subject: [PATCH] mm: Remove zone_id() and make use of zone_idx() in is_dev_zone() Date: Mon, 30 Jul 2018 15:37:18 +0200 Message-Id: <20180730133718.28683-1-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 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 is_dev_zone() is using zone_id() to check if the zone is ZONE_DEVICE. zone_id() looks pretty much the same as zone_idx(), and while the use of zone_idx() is quite spread in the kernel, zone_id() is only being used by is_dev_zone(). This patch removes zone_id() and makes is_dev_zone() use zone_idx() to check the zone, so we do not have two things with the same functionality around. Signed-off-by: Oscar Salvador Acked-by: Michal Hocko Acked-by: Vlastimil Babka Reviewed-by: Pavel Tatashin --- include/linux/mmzone.h | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 83b1d11e90eb..dbe7635c33dd 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -755,25 +755,6 @@ static inline bool pgdat_is_empty(pg_data_t *pgdat) return !pgdat->node_start_pfn && !pgdat->node_spanned_pages; } -static inline int zone_id(const struct zone *zone) -{ - struct pglist_data *pgdat = zone->zone_pgdat; - - return zone - pgdat->node_zones; -} - -#ifdef CONFIG_ZONE_DEVICE -static inline bool is_dev_zone(const struct zone *zone) -{ - return zone_id(zone) == ZONE_DEVICE; -} -#else -static inline bool is_dev_zone(const struct zone *zone) -{ - return false; -} -#endif - #include void build_all_zonelists(pg_data_t *pgdat); @@ -824,6 +805,18 @@ static inline int local_memory_node(int node_id) { return node_id; }; */ #define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) +#ifdef CONFIG_ZONE_DEVICE +static inline bool is_dev_zone(const struct zone *zone) +{ + return zone_idx(zone) == ZONE_DEVICE; +} +#else +static inline bool is_dev_zone(const struct zone *zone) +{ + return false; +} +#endif + /* * Returns true if a zone has pages managed by the buddy allocator. * All the reclaim decisions have to use this function rather than