All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Alistair Popple <apopple@nvidia.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
	Wei Xu <weixugc@google.com>, Huang Ying <ying.huang@intel.com>,
	Yang Shi <shy828301@gmail.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Tim C Chen <tim.c.chen@intel.com>,
	Michal Hocko <mhocko@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Hesham Almatary <hesham.almatary@huawei.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Jagdish Gediya <jvgediya@linux.ibm.com>
Subject: Re: [PATCH v7 09/12] mm/demotion: Demote pages according to allocation fallback order
Date: Mon, 27 Jun 2022 09:24:31 +0530	[thread overview]
Message-ID: <87czeuzrpk.fsf@linux.ibm.com> (raw)
In-Reply-To: <87czf06q1i.fsf@nvdebian.thelocal>

Alistair Popple <apopple@nvidia.com> writes:

> "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
>
>> From: Jagdish Gediya <jvgediya@linux.ibm.com>
>
> [...]
>
>> -static struct page *alloc_demote_page(struct page *page, unsigned long node)
>> +static struct page *alloc_demote_page(struct page *page, unsigned long private)
>>  {
>> -	struct migration_target_control mtc = {
>> -		/*
>> -		 * Allocate from 'node', or fail quickly and quietly.
>> -		 * When this happens, 'page' will likely just be discarded
>> -		 * instead of migrated.
>> -		 */
>> -		.gfp_mask = (GFP_HIGHUSER_MOVABLE & ~__GFP_RECLAIM) |
>> -			    __GFP_THISNODE  | __GFP_NOWARN |
>> -			    __GFP_NOMEMALLOC | GFP_NOWAIT,
>> -		.nid = node
>> -	};
>> +	struct page *target_page;
>> +	nodemask_t *allowed_mask;
>> +	struct migration_target_control *mtc;
>> +
>> +	mtc = (struct migration_target_control *)private;
>> +
>> +	allowed_mask = mtc->nmask;
>> +	/*
>> +	 * make sure we allocate from the target node first also trying to
>> +	 * reclaim pages from the target node via kswapd if we are low on
>> +	 * free memory on target node. If we don't do this and if we have low
>> +	 * free memory on the target memtier, we would start allocating pages
>> +	 * from higher memory tiers without even forcing a demotion of cold
>> +	 * pages from the target memtier. This can result in the kernel placing
>> +	 * hotpages in higher memory tiers.
>> +	 */
>> +	mtc->nmask = NULL;
>> +	mtc->gfp_mask |= __GFP_THISNODE;
>> +	target_page = alloc_migration_target(page, (unsigned long)&mtc);
>
> I finally managed to get a system setup to start testing some of this
> out. However it quickly crashed due to the bad pointer in the above call
> - you need mtc not &mtc here.

I remember fixing that during earlier testing. I guess I missed to copy
the change from test to my development. Thanks for testing this. I have
now also tested the complete series with the above-suggested changes and did
make sure we are indeed doing demotion by looking at
/proc/vmstat:pgdemote_kswapd/pgdemote_direct 

>
>> +	if (target_page)
>> +		return target_page;
>> +
>> +	mtc->gfp_mask &= ~__GFP_THISNODE;
>> +	mtc->nmask = allowed_mask;
>>
>>  	return alloc_migration_target(page, (unsigned long)&mtc);
>
> And here.
>

I will fold this changes in and send a v8 after waiting for review
feedback from others.

-aneesh

  reply	other threads:[~2022-06-27  3:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22  8:25 [PATCH v7 00/12] mm/demotion: Memory tiers and demotion Aneesh Kumar K.V
2022-06-22  8:25 ` [PATCH v7 01/12] mm/demotion: Add support for explicit memory tiers Aneesh Kumar K.V
2022-06-22  8:25 ` [PATCH v7 02/12] mm/demotion: Move memory demotion related code Aneesh Kumar K.V
2022-06-22  8:25 ` [PATCH v7 03/12] mm/demotion/dax/kmem: Set node's memory tier to MEMORY_TIER_PMEM Aneesh Kumar K.V
2022-06-22  8:25 ` [PATCH v7 04/12] mm/demotion: Add hotplug callbacks to handle new numa node onlined Aneesh Kumar K.V
2022-06-22  8:25 ` [PATCH v7 05/12] mm/demotion: Build demotion targets based on explicit memory tiers Aneesh Kumar K.V
2022-06-22  8:25 ` [PATCH v7 06/12] mm/demotion: Expose memory tier details via sysfs Aneesh Kumar K.V
2022-06-22  8:25 ` [PATCH v7 07/12] mm/demotion: Add per node memory tier attribute to sysfs Aneesh Kumar K.V
2022-06-22  8:25 ` [PATCH v7 08/12] mm/demotion: Add pg_data_t member to track node memory tier details Aneesh Kumar K.V
2022-06-22 22:52   ` kernel test robot
2022-06-22  8:25 ` [PATCH v7 09/12] mm/demotion: Demote pages according to allocation fallback order Aneesh Kumar K.V
2022-06-23  2:53   ` Alistair Popple
2022-06-27  3:54     ` Aneesh Kumar K.V [this message]
2022-06-27  4:18       ` Alistair Popple
2022-06-22  8:25 ` [PATCH v7 10/12] mm/demotion: Update node_is_toptier to work with memory tiers Aneesh Kumar K.V
2022-06-22  8:25 ` [PATCH v7 11/12] mm/demotion: Add documentation for memory tiering Aneesh Kumar K.V
2022-06-22 21:21   ` kernel test robot
2022-06-25  2:56     ` Bagas Sanjaya
2022-06-25  2:56       ` Bagas Sanjaya
2022-06-25  4:13   ` Bagas Sanjaya
2022-06-27  4:40     ` Aneesh Kumar K.V
2022-06-30  0:57   ` Souptick Joarder
2022-06-22  8:25 ` [PATCH v7 12/12] mm/demotion: Add sysfs ABI documentation Aneesh Kumar K.V
2022-06-22 11:06 ` [PATCH v7 00/12] mm/demotion: Memory tiers and demotion Aneesh Kumar K.V

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=87czeuzrpk.fsf@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dave@stgolabs.net \
    --cc=hesham.almatary@huawei.com \
    --cc=jvgediya@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=shy828301@gmail.com \
    --cc=tim.c.chen@intel.com \
    --cc=weixugc@google.com \
    --cc=ying.huang@intel.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.