lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YBfqzlG1C1mtKj4Z@dhcp22.suse.cz>
Date:   Mon, 1 Feb 2021 12:49:47 +0100
From:   Michal Hocko <mhocko@...e.com>
To:     Mike Kravetz <mike.kravetz@...cle.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Oscar Salvador <osalvador@...e.de>,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
        Muchun Song <songmuchun@...edance.com>,
        David Hildenbrand <david@...hat.com>,
        Matthew Wilcox <willy@...radead.org>,
        Miaohe Lin <linmiaohe@...wei.com>
Subject: Re: [PATCH v3 3/5] hugetlb: only set HPageMigratable for migratable
 hstates

On Fri 29-01-21 10:46:15, Mike Kravetz wrote:
> On 1/28/21 2:15 PM, Andrew Morton wrote:
> > On Thu, 28 Jan 2021 14:00:29 -0800 Mike Kravetz <mike.kravetz@...cle.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@...cle.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@...cle.com>

Acked-by: Michal Hocko <mhocko@...e.com>

Thanks Mike!

> ---
>  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
> 

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ