LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Ding Hui <dinghui@sangfor.com.cn>
To: david@redhat.com, naoya.horiguchi@nec.com, osalvador@suse.de
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, Ding Hui <dinghui@sangfor.com.cn>
Subject: [PATCH v2] mm/page_alloc: fix counting of free pages after take off from buddy
Date: Sat,  8 May 2021 11:55:33 +0800
Message-ID: <20210508035533.23222-1-dinghui@sangfor.com.cn> (raw)
In-Reply-To: <8cd355d2-1adc-4189-7b65-cfea13129db5@sangfor.com.cn>

Recently we found there is a lot MemFree left in /proc/meminfo after
do a lot of pages soft offline.

I think it's incorrect since NR_FREE_PAGES should not contain HWPoison pages.
For offline free pages, after a successful call take_page_off_buddy(), the
page is no longer belong to buddy allocator, and will not be used any more,
but we missed accounting NR_FREE_PAGES in this situation.

Do update like rmqueue() does.

Signed-off-by: Ding Hui <dinghui@sangfor.com.cn>
---
V2:
use __mod_zone_freepage_state instead of __mod_zone_page_state

 mm/page_alloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index cfc72873961d..e124a615303b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8947,6 +8947,7 @@ bool take_page_off_buddy(struct page *page)
 			del_page_from_free_list(page_head, zone, page_order);
 			break_down_buddy_pages(zone, page_head, page, 0,
 						page_order, migratetype);
+			__mod_zone_freepage_state(zone, -1, migratetype);
 			ret = true;
 			break;
 		}
-- 
2.17.1


  reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21  2:04 [RFC PATCH] " Ding Hui
2021-04-28 14:54 ` David Hildenbrand
2021-04-30  9:43   ` Ding Hui
2021-05-08  3:55     ` Ding Hui [this message]
2021-05-25  8:32       ` [PATCH v2] " HORIGUCHI NAOYA(堀口 直也)
2021-05-26  0:43         ` Ding Hui
2021-05-06  2:49   ` [RFC PATCH] " HORIGUCHI NAOYA(堀口 直也)
2021-05-06  4:01     ` Ding Hui
2021-05-06  7:30       ` HORIGUCHI NAOYA(堀口 直也)
2021-05-07  1:46         ` Ding Hui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210508035533.23222-1-dinghui@sangfor.com.cn \
    --to=dinghui@sangfor.com.cn \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=naoya.horiguchi@nec.com \
    --cc=osalvador@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
	git clone --mirror https://lore.kernel.org/lkml/10 lkml/git/10.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git