linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Muchun Song <muchun.song@linux.dev>
Cc: Linux Memory Management List <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Jiaqi Yan <jiaqiyan@google.com>,
	Naoya Horiguchi <naoya.horiguchi@linux.dev>,
	Muchun Song <songmuchun@bytedance.com>,
	Miaohe Lin <linmiaohe@huawei.com>,
	Axel Rasmussen <axelrasmussen@google.com>,
	James Houghton <jthoughton@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/2] hugetlb: Do not clear hugetlb dtor until allocating vmemmap
Date: Wed, 12 Jul 2023 17:22:21 -0700	[thread overview]
Message-ID: <20230713002221.GF6354@monkey> (raw)
In-Reply-To: <20230712181445.GD6354@monkey>

On 07/12/23 11:14, Mike Kravetz wrote:
> On 07/12/23 16:03, Muchun Song wrote:
> > > On Jul 12, 2023, at 06:09, Mike Kravetz <mike.kravetz@oracle.com> wrote:
> > > 
> > > Note that this will leave hugetlb pages in a state where they are marked
> > > free (by hugetlb specific page flag) and have a ref count.  This is not
> > > a normal state.  The only code that would notice is the memory error
> > > code, and it is set up to retry in such a case.
> > > 
> > > A subsequent patch will create a routine to do bulk processing of
> > > vmemmap allocation.  This will eliminate a lock/unlock cycle for each
> > > hugetlb page in the case where we are freeing a large number of pages.
> > > 
> > > Fixes: ad2fa3717b74 ("mm: hugetlb: alloc the vmemmap pages associated with each HugeTLB page")
> > > Cc: <stable@vger.kernel.org>
> > > Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
> > 
> > Hi Mike,
> > 
> > I have seen an issue proposed by Jiaqi Yan in [1]. I didn't see any
> > resolution for it. Am I missing something with this fix?
> > 
> > [1] https://lore.kernel.org/linux-mm/CACw3F53iPiLrJt4pyaX2aaZ5BVg9tj8x_k6-v7=9Xn1nrh=UCw@mail.gmail.com/
> > 
> 
> My mistake!  I sent the old version of the patch.
> 
> The new version was modified to simply check the destructor via
> folio_test_hugetlb() in order to decide if it should be cleared.
> 
> I will send V2.  Sorry!

I was about to send v2 when I noticed that this approach opened another
race window.  :(  Closing the window should be just a matter of
reordering code.  I will take a day or two to make sure I did not miss
something else.
-- 
Mike Kravetz


  reply	other threads:[~2023-07-13  0:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11 22:09 [PATCH 0/2] Fix hugetlb free path race with memory errors Mike Kravetz
2023-07-11 22:09 ` [PATCH 1/2] hugetlb: Do not clear hugetlb dtor until allocating vmemmap Mike Kravetz
2023-07-12  8:03   ` Muchun Song
2023-07-12 18:14     ` Mike Kravetz
2023-07-13  0:22       ` Mike Kravetz [this message]
2023-07-11 22:09 ` [PATCH 2/2] hugetlb: optimize update_and_free_pages_bulk to avoid lock cycles Mike Kravetz
2023-07-13 17:34 ` [PATCH 0/2] Fix hugetlb free path race with memory errors Andrew Morton

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=20230713002221.GF6354@monkey \
    --to=mike.kravetz@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=jiaqiyan@google.com \
    --cc=jthoughton@google.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=naoya.horiguchi@linux.dev \
    --cc=songmuchun@bytedance.com \
    --cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).