linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Muchun Song <songmuchun@bytedance.com>
Cc: <akpm@linux-foundation.org>, <shy828301@gmail.com>,
	<willy@infradead.org>, <zokeefe@google.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 13/16] mm/huge_memory: add helper __get_deferred_split_queue
Date: Thu, 23 Jun 2022 20:11:09 +0800	[thread overview]
Message-ID: <a07cb5cc-eb8c-3a01-38a8-b06c7d5427c1@huawei.com> (raw)
In-Reply-To: <YrQQNs42R519/P8X@FVFYT0MHHV2J.usts.net>

On 2022/6/23 15:03, Muchun Song wrote:
> On Thu, Jun 23, 2022 at 01:06:24AM +0800, Miaohe Lin wrote:
>> Add helper __get_deferred_split_queue to remove the duplicated codes of
>> getting ds_queue. No functional change intended.
>>
> 
> Sorry, I suggest dropping this change since I have reworked the code here [1].

That's all right. Thanks for your work. :)

> 
> [1] https://lore.kernel.org/all/20220621125658.64935-7-songmuchun@bytedance.com/
> 
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>>  mm/huge_memory.c | 35 ++++++++++++-----------------------
>>  1 file changed, 12 insertions(+), 23 deletions(-)
>>
>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>> index 0030b4f67cd9..de8155ff584c 100644
>> --- a/mm/huge_memory.c
>> +++ b/mm/huge_memory.c
>> @@ -555,25 +555,23 @@ pmd_t maybe_pmd_mkwrite(pmd_t pmd, struct vm_area_struct *vma)
>>  	return pmd;
>>  }
>>  
>> -#ifdef CONFIG_MEMCG
>> -static inline struct deferred_split *get_deferred_split_queue(struct page *page)
>> +static inline struct deferred_split *__get_deferred_split_queue(struct pglist_data *pgdat,
>> +								struct mem_cgroup *memcg)
>>  {
>> -	struct mem_cgroup *memcg = page_memcg(compound_head(page));
>> -	struct pglist_data *pgdat = NODE_DATA(page_to_nid(page));
>> -
>> +#ifdef CONFIG_MEMCG
>>  	if (memcg)
>>  		return &memcg->deferred_split_queue;
>> -	else
>> -		return &pgdat->deferred_split_queue;
>> +#endif
>> +	return &pgdat->deferred_split_queue;
>>  }
>> -#else
>> +
>>  static inline struct deferred_split *get_deferred_split_queue(struct page *page)
>>  {
>> +	struct mem_cgroup *memcg = page_memcg(compound_head(page));
>>  	struct pglist_data *pgdat = NODE_DATA(page_to_nid(page));
>>  
>> -	return &pgdat->deferred_split_queue;
>> +	return __get_deferred_split_queue(pgdat, memcg);
>>  }
>> -#endif
>>  
>>  void prep_transhuge_page(struct page *page)
>>  {
>> @@ -2774,31 +2772,22 @@ void deferred_split_huge_page(struct page *page)
>>  static unsigned long deferred_split_count(struct shrinker *shrink,
>>  		struct shrink_control *sc)
>>  {
>> -	struct pglist_data *pgdata = NODE_DATA(sc->nid);
>> -	struct deferred_split *ds_queue = &pgdata->deferred_split_queue;
>> +	struct deferred_split *ds_queue;
>>  
>> -#ifdef CONFIG_MEMCG
>> -	if (sc->memcg)
>> -		ds_queue = &sc->memcg->deferred_split_queue;
>> -#endif
>> +	ds_queue = __get_deferred_split_queue(NODE_DATA(sc->nid), sc->memcg);
>>  	return READ_ONCE(ds_queue->split_queue_len);
>>  }
>>  
>>  static unsigned long deferred_split_scan(struct shrinker *shrink,
>>  		struct shrink_control *sc)
>>  {
>> -	struct pglist_data *pgdata = NODE_DATA(sc->nid);
>> -	struct deferred_split *ds_queue = &pgdata->deferred_split_queue;
>> +	struct deferred_split *ds_queue;
>>  	unsigned long flags;
>>  	LIST_HEAD(list), *pos, *next;
>>  	struct page *page;
>>  	int split = 0;
>>  
>> -#ifdef CONFIG_MEMCG
>> -	if (sc->memcg)
>> -		ds_queue = &sc->memcg->deferred_split_queue;
>> -#endif
>> -
>> +	ds_queue = __get_deferred_split_queue(NODE_DATA(sc->nid), sc->memcg);
>>  	spin_lock_irqsave(&ds_queue->split_queue_lock, flags);
>>  	/* Take pin on all head pages to avoid freeing them under us */
>>  	list_for_each_safe(pos, next, &ds_queue->split_queue) {
>> -- 
>> 2.23.0
>>
>>
> .
> 



  reply	other threads:[~2022-06-23 12:11 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 17:06 [PATCH 00/16] A few cleanup patches for huge_memory Miaohe Lin
2022-06-22 17:06 ` [PATCH 01/16] mm/huge_memory: use flush_pmd_tlb_range in move_huge_pmd Miaohe Lin
2022-06-23  6:30   ` Muchun Song
2022-06-24 18:32     ` Zach O'Keefe
2022-06-22 17:06 ` [PATCH 02/16] mm/huge_memory: access vm_page_prot with READ_ONCE in remove_migration_pmd Miaohe Lin
2022-06-23  3:14   ` Kirill A. Shutemov
2022-06-23 12:03     ` Miaohe Lin
2022-06-24 18:40       ` Zach O'Keefe
2022-06-25  3:17         ` Miaohe Lin
2022-06-22 17:06 ` [PATCH 03/16] mm/huge_memory: fix comment of __pud_trans_huge_lock Miaohe Lin
2022-06-23  6:32   ` Muchun Song
2022-06-24 18:47   ` Zach O'Keefe
2022-06-25  3:33     ` Miaohe Lin
2022-06-24 18:56   ` Matthew Wilcox
2022-06-25  3:32     ` Miaohe Lin
2022-06-22 17:06 ` [PATCH 04/16] mm/huge_memory: use helper touch_pud in huge_pud_set_accessed Miaohe Lin
2022-06-23  6:42   ` Muchun Song
2022-06-23 12:08     ` Miaohe Lin
2022-06-22 17:06 ` [PATCH 05/16] mm/huge_memory: use helper touch_pmd in huge_pmd_set_accessed Miaohe Lin
2022-06-23  6:43   ` Muchun Song
2022-06-22 17:06 ` [PATCH 06/16] mm/huge_memory: rename mmun_start to haddr in remove_migration_pmd Miaohe Lin
2022-06-23  6:46   ` Muchun Song
2022-06-22 17:06 ` [PATCH 07/16] mm/huge_memory: minor cleanup for split_huge_pages_pid Miaohe Lin
2022-06-23  3:22   ` Kirill A. Shutemov
2022-06-23 12:07     ` Miaohe Lin
2022-06-22 17:06 ` [PATCH 08/16] mm/huge_memory: use helper macro __ATTR_RW Miaohe Lin
2022-06-23  6:49   ` Muchun Song
2022-06-22 17:06 ` [PATCH 09/16] mm/huge_memory: fix comment in zap_huge_pud Miaohe Lin
2022-06-22 17:06 ` [PATCH 10/16] mm/huge_memory: check pmd_present first in is_huge_zero_pmd Miaohe Lin
2022-06-23  6:59   ` Muchun Song
2022-06-22 17:06 ` [PATCH 11/16] mm/huge_memory: try to free subpage in swapcache when possible Miaohe Lin
2022-06-22 17:06 ` [PATCH 12/16] mm/huge_memory: minor cleanup for split_huge_pages_all Miaohe Lin
2022-06-22 17:06 ` [PATCH 13/16] mm/huge_memory: add helper __get_deferred_split_queue Miaohe Lin
2022-06-23  7:03   ` Muchun Song
2022-06-23 12:11     ` Miaohe Lin [this message]
2022-06-22 17:06 ` [PATCH 14/16] mm/huge_memory: fix comment of page_deferred_list Miaohe Lin
2022-06-23  7:24   ` Muchun Song
2022-06-23 12:26     ` Miaohe Lin
2022-06-24 17:09       ` Zach O'Keefe
2022-06-25  3:18         ` Miaohe Lin
2022-06-22 17:06 ` [PATCH 15/16] mm/huge_memory: correct comment of prep_transhuge_page Miaohe Lin
2022-06-23  7:26   ` Muchun Song
2022-06-22 17:06 ` [PATCH 16/16] mm/huge_memory: comment the subtle logic in __split_huge_pmd Miaohe Lin

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=a07cb5cc-eb8c-3a01-38a8-b06c7d5427c1@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shy828301@gmail.com \
    --cc=songmuchun@bytedance.com \
    --cc=willy@infradead.org \
    --cc=zokeefe@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox