Message ID | 20230319114214.2133332-1-rppt@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp693330wrt; Sun, 19 Mar 2023 05:05:37 -0700 (PDT) X-Google-Smtp-Source: AK7set+kf7LS9VrVrOQ5/0AahNYa2n+UrqlXYe0hXG77V0WxzKh1G9VWxhlSC2WTgzglUW0Q8uBL X-Received: by 2002:a17:902:f94c:b0:19d:5fd:11fb with SMTP id kx12-20020a170902f94c00b0019d05fd11fbmr11851171plb.23.1679227536874; Sun, 19 Mar 2023 05:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679227536; cv=none; d=google.com; s=arc-20160816; b=JicN3EnayIJNDdbBxO1EEdGJ9OtklYe+KaR32KC6lUumuv0D+PZDTUy82TgiCjngeu hRidixqPgxaUaOo8rumt1WXfcec0209BwyMRGRCneym22oxe10a33+9n8hn+iTq4VLMb HCH7QqhhbdPqiSjcWpj2OoH/JT726uowSya06RymebTe35NpiBRittICufVv1IiE73cR B1HZizgHTD7iyrcEn5MInz8MyxLzdgu2B3+3aYJ7UlfLr+1umJ+T1FFYmyrpxR0gBa2j 26qHqWcmaNjW7bDRiPVi7LF1g6ZwrtWYa6gkaynJ/QzHWMgVAi8kJFk8VDLdMRDACKp0 lICw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=RnK/IYBHQhIgmpLQg3WmPvJSxa6uUptn8+BLsoQU1lk=; b=MZa0Mtdr40iIeeR7BN6IMlNNsWxPFzfkv/laOowobrYGCnkxXCjzgCCDpz7UUcl1f+ 2wWpM/Tf7rozzt5+OnRVdDmKLSybyRWNct3DLohCAI+huaJkNYQWrlvkyGAr7flF74fO oTKMxZNElaY6Ku1TvS1qlC9ZyoOP7LLLGRiLIkoyfeloCKwxItRpVLptQ17/9v/aS9jw qal1IY5woMABRdtUwyoVkTwRdZafLFxccTBaRGwcKYMrdZHfolVZhFpZ2c0RKgPHfF7B 8Qs4SuQp9ltUWQ9qZOONYzWBZIh6yHOnvrRdVYNy0WvAqDVChhnGVm0iHipqbTEKwHZD FuyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jpHhyinU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u15-20020a170903124f00b0019e2fdaba57si8525250plh.288.2023.03.19.05.04.59; Sun, 19 Mar 2023 05:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jpHhyinU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230285AbjCSLmd (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Sun, 19 Mar 2023 07:42:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbjCSLma (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 19 Mar 2023 07:42:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8EB823647 for <linux-kernel@vger.kernel.org>; Sun, 19 Mar 2023 04:42:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B32FE60FCF for <linux-kernel@vger.kernel.org>; Sun, 19 Mar 2023 11:42:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9254C433D2; Sun, 19 Mar 2023 11:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679226146; bh=3Ae5b1cM6n8dUopEW2/hVH5kWClmHMJCBK1/s5YMwP0=; h=From:To:Cc:Subject:Date:From; b=jpHhyinUPVEMDa7Bt5tUDUQt7uPQvb5YR+li6BaYImkNbTNB9nCB17Bc0d6npSG7H cmuw83vRra+IXFNs0Wqb44B2bvoXZPRrXSYHsAd3pxaPTiElPKRNCc2QXRWak00OPG 8Y/AsZ7gmwKX65vkZsOeQPWF4A6bF89ey4ZNC3UxGjcq9PDJw3bENhEoq/xJurnf3+ bXxrB5OqDODukOS0mC75E0s/JjNPD7oMTH5899IMPU4mYDmhJudZtojJrCFwmlX8W9 M5QPhU7GYiVABKK6xnM86y+cCsrT0O6H+SJh33AL77vAXcuTsFt7p1bkqTQdkRJ3e+ WYDqYPiWMnK5Q== From: Mike Rapoport <rppt@kernel.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: Mike Rapoport <rppt@kernel.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: move get_page_from_free_area() to mm/page_alloc.c Date: Sun, 19 Mar 2023 13:42:14 +0200 Message-Id: <20230319114214.2133332-1-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760797693690857824?= X-GMAIL-MSGID: =?utf-8?q?1760797693690857824?= |
Series |
mm: move get_page_from_free_area() to mm/page_alloc.c
|
|
Commit Message
Mike Rapoport
March 19, 2023, 11:42 a.m. UTC
From: "Mike Rapoport (IBM)" <rppt@kernel.org> The get_page_from_free_area() helper is only used in mm/page_alloc.c so move it there to reduce noise in include/linux/mmzone.h Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org> --- include/linux/mmzone.h | 7 ------- mm/page_alloc.c | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) base-commit: 4018ab1f7cec061b8425737328edefebdc0ab832
Comments
On Sun, Mar 19, 2023 at 01:42:14PM +0200, Mike Rapoport wrote: > From: "Mike Rapoport (IBM)" <rppt@kernel.org> > > The get_page_from_free_area() helper is only used in mm/page_alloc.c so > move it there to reduce noise in include/linux/mmzone.h > > Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org> > --- > include/linux/mmzone.h | 7 ------- > mm/page_alloc.c | 7 +++++++ > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index 96599cb9eb62..8f5a9e2c722a 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -108,13 +108,6 @@ struct free_area { > unsigned long nr_free; > }; > > -static inline struct page *get_page_from_free_area(struct free_area *area, > - int migratetype) > -{ > - return list_first_entry_or_null(&area->free_list[migratetype], > - struct page, lru); > -} > - > static inline bool free_area_empty(struct free_area *area, int migratetype) > { > return list_empty(&area->free_list[migratetype]); > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 87d760236dba..2e72fdbdd8db 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1048,6 +1048,13 @@ static inline void del_page_from_free_list(struct page *page, struct zone *zone, > zone->free_area[order].nr_free--; > } > > +static inline struct page *get_page_from_free_area(struct free_area *area, > + int migratetype) > +{ > + return list_first_entry_or_null(&area->free_list[migratetype], > + struct page, lru); > +} > + > /* > * If this is not the largest possible page, check if the buddy > * of the next-highest order is free. If it is, it's possible > > base-commit: 4018ab1f7cec061b8425737328edefebdc0ab832 > -- > 2.35.1 > Good catch, I wonder if there are more functions like this that can be dropped from headers? Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
On Sun, Mar 19, 2023 at 01:42:14PM +0200, Mike Rapoport wrote: > From: "Mike Rapoport (IBM)" <rppt@kernel.org> > > The get_page_from_free_area() helper is only used in mm/page_alloc.c so > move it there to reduce noise in include/linux/mmzone.h > > Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
On Sun, Mar 19, 2023 at 12:07:43PM +0000, Lorenzo Stoakes wrote: > On Sun, Mar 19, 2023 at 01:42:14PM +0200, Mike Rapoport wrote: > > From: "Mike Rapoport (IBM)" <rppt@kernel.org> > > > > The get_page_from_free_area() helper is only used in mm/page_alloc.c so > > move it there to reduce noise in include/linux/mmzone.h Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> > Good catch, I wonder if there are more functions like this that can be dropped > from headers? I don't think anything outside mm/ has any reason to see 'struct free_area'. Unfortunately, it's a field in struct zone, so moving it out of mmzone.h will be hard (unless we can move struct zone out of mmzone.h?) free_area_empty() can move to mm/internal.h though
On Sun, Mar 19, 2023 at 08:22:14PM +0000, Matthew Wilcox wrote: > On Sun, Mar 19, 2023 at 12:07:43PM +0000, Lorenzo Stoakes wrote: > > On Sun, Mar 19, 2023 at 01:42:14PM +0200, Mike Rapoport wrote: > > > From: "Mike Rapoport (IBM)" <rppt@kernel.org> > > > > > > The get_page_from_free_area() helper is only used in mm/page_alloc.c so > > > move it there to reduce noise in include/linux/mmzone.h > > Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> > > > Good catch, I wonder if there are more functions like this that can be dropped > > from headers? > > I don't think anything outside mm/ has any reason to see 'struct > free_area'. Unfortunately, it's a field in struct zone, so moving > it out of mmzone.h will be hard (unless we can move struct zone out of > mmzone.h?) Seems possible but not trivial. > free_area_empty() can move to mm/internal.h though Yes.
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 96599cb9eb62..8f5a9e2c722a 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -108,13 +108,6 @@ struct free_area { unsigned long nr_free; }; -static inline struct page *get_page_from_free_area(struct free_area *area, - int migratetype) -{ - return list_first_entry_or_null(&area->free_list[migratetype], - struct page, lru); -} - static inline bool free_area_empty(struct free_area *area, int migratetype) { return list_empty(&area->free_list[migratetype]); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 87d760236dba..2e72fdbdd8db 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1048,6 +1048,13 @@ static inline void del_page_from_free_list(struct page *page, struct zone *zone, zone->free_area[order].nr_free--; } +static inline struct page *get_page_from_free_area(struct free_area *area, + int migratetype) +{ + return list_first_entry_or_null(&area->free_list[migratetype], + struct page, lru); +} + /* * If this is not the largest possible page, check if the buddy * of the next-highest order is free. If it is, it's possible