linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Oscar Salvador <osalvador@suse.de>,
	Michal Hocko <mhocko@suse.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Muchun Song <songmuchun@bytedance.com>,
	David Hildenbrand <david@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	Miaohe Lin <linmiaohe@huawei.com>
Subject: Re: [PATCH v3 3/5] hugetlb: only set HPageMigratable for migratable hstates
Date: Fri, 29 Jan 2021 10:46:15 -0800	[thread overview]
Message-ID: <62a80585-2a73-10cc-4a2d-5721540d4ad2@oracle.com> (raw)
In-Reply-To: <20210128141531.17fec31e6075fe0eb6e33683@linux-foundation.org>

On 1/28/21 2:15 PM, Andrew Morton wrote:
> On Thu, 28 Jan 2021 14:00:29 -0800 Mike Kravetz <mike.kravetz@oracle.com> wrote:
>>
>> Michal suggested that comments describing synchronization be added for each
>> flag.  Since I did 'one patch per flag', that would be an update to each patch.
>> Or, I could simply add a patch to update the comment block based on what you
>> already have.
>>
>> Let me know what is best/easiest for you.
> 
> I guess just one patch is best for reviewers.  Then I'll split up into
> a sprinkle of -fix patches if I'm feeling energetic ;)

Here is a patch to update the comments for all those flags.  It should
apply on top of what is in your tree.

From: Mike Kravetz <mike.kravetz@oracle.com>
Date: Fri, 29 Jan 2021 10:36:12 -0800
Subject: [PATCH] huegtlb: add synchronization information for new hugetlb
 specific flags

Adding comments, no functional change.

Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
---
 include/linux/hugetlb.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index e5e6ffd55392..cf70795d2209 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -480,14 +480,24 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
  * HPG_restore_reserve - Set when a hugetlb page consumes a reservation at
  *	allocation time.  Cleared when page is fully instantiated.  Free
  *	routine checks flag to restore a reservation on error paths.
+ *	Synchronization:  Examined or modified by code that knows it has
+ *	the only reference to page.  i.e. After allocation but before use
+ *	or when the page is being freed.
  * HPG_migratable  - Set after a newly allocated page is added to the page
  *	cache and/or page tables.  Indicates the page is a candidate for
  *	migration.
+ *	Synchronization:  Initially set after new page allocation with no
+ *	locking.  When examined and modified during migration processing
+ *	(isolate, migrate, putback) the hugetlb_lock is held.
  * HPG_temporary - - Set on a page that is temporarily allocated from the buddy
  *	allocator.  Typically used for migration target pages when no pages
  *	are available in the pool.  The hugetlb free page path will
  *	immediately free pages with this flag set to the buddy allocator.
+ *	Synchronization: Can be set after huge page allocation from buddy when
+ *	code knows it has only reference.  All other examinations and
+ *	modifications require hugetlb_lock.
  * HPG_freed - Set when page is on the free lists.
+ *	Synchronization: hugetlb_lock held for examination and modification.
  */
 enum hugetlb_page_flags {
 	HPG_restore_reserve = 0,
-- 
2.29.2



  parent reply	other threads:[~2021-01-29 18:46 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 19:52 [PATCH v3 0/5] create hugetlb flags to consolidate state Mike Kravetz
2021-01-22 19:52 ` [PATCH v3 1/5] hugetlb: use page.private for hugetlb specific page flags Mike Kravetz
2021-01-26  8:17   ` Oscar Salvador
2021-01-27 10:20   ` Michal Hocko
2021-01-27 23:01     ` Mike Kravetz
2021-01-27 10:26   ` Michal Hocko
2021-01-22 19:52 ` [PATCH v3 2/5] hugetlb: convert page_huge_active() HPageMigratable flag Mike Kravetz
2021-01-27 10:25   ` Michal Hocko
2021-01-27 23:27     ` Mike Kravetz
2021-01-22 19:52 ` [PATCH v3 3/5] hugetlb: only set HPageMigratable for migratable hstates Mike Kravetz
2021-01-26  8:20   ` Oscar Salvador
2021-01-27 10:35   ` Michal Hocko
2021-01-27 23:36     ` Mike Kravetz
2021-01-28  5:52       ` Oscar Salvador
2021-01-28 21:37         ` Andrew Morton
2021-01-28 22:00           ` Mike Kravetz
2021-01-28 22:15             ` Andrew Morton
2021-01-29  9:09               ` Michal Hocko
2021-01-29 18:46               ` Mike Kravetz [this message]
2021-02-01 11:49                 ` Michal Hocko
2021-02-04  1:11                   ` Mike Kravetz
2021-01-22 19:52 ` [PATCH v3 4/5] hugetlb: convert PageHugeTemporary() to HPageTemporary flag Mike Kravetz
2021-01-23  3:15   ` [External] " Muchun Song
2021-01-27 10:39   ` Michal Hocko
2021-01-22 19:52 ` [PATCH v3 5/5] hugetlb: convert PageHugeFreed to HPageFreed flag Mike Kravetz
2021-01-27 10:41   ` Michal Hocko
2021-01-27 23:37     ` Mike Kravetz

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=62a80585-2a73-10cc-4a2d-5721540d4ad2@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=osalvador@suse.de \
    --cc=songmuchun@bytedance.com \
    --cc=willy@infradead.org \
    /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