From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0437CC432C3 for ; Wed, 20 Jan 2021 10:45:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 900DE23339 for ; Wed, 20 Jan 2021 10:45:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 900DE23339 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 175D16B0005; Wed, 20 Jan 2021 05:45:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 126D96B0006; Wed, 20 Jan 2021 05:45:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 014786B000A; Wed, 20 Jan 2021 05:45:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0129.hostedemail.com [216.40.44.129]) by kanga.kvack.org (Postfix) with ESMTP id DBF8F6B0005 for ; Wed, 20 Jan 2021 05:45:24 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A2890180AD81D for ; Wed, 20 Jan 2021 10:45:24 +0000 (UTC) X-FDA: 77725821768.11.vest57_1f12f6327559 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 78493180F8B82 for ; Wed, 20 Jan 2021 10:45:24 +0000 (UTC) X-HE-Tag: vest57_1f12f6327559 X-Filterd-Recvd-Size: 6773 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 10:45:23 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id n10so14910104pgl.10 for ; Wed, 20 Jan 2021 02:45:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6SjORLENF92riIGeJfZ5A1xf2v8XQdFzn5b/CqTBC7s=; b=jv7NPPPWUQHH/nfsSwCRDcXJCzcY0xUJLgtb99rNy+2T+ty/HJCeynfpbKP9KMTc0o 2JBKbNEvARL9PKdkIdRPEeY35hHIMqvH6WtlFV/rHVvBGqNVSv2v5/4ugLEMxg7NVSTW kq5Ex1QJhl2M+HYPl5jzmyofjRWO1jpguLS3lIq/ig4RbtZDVRcwVwueSpR2qw4QXyKm vi9B+c2LxH41/lTTcuSrM4bFK4iMP2676AAFaQlR96G8lHQR8u/4No55cAoaROG7Mxvv T25VZ3FMssyDL4zS/L6U4mCfUHDz2pt/HKAlRFTNfT0hw9z1DMaEK5rbffoEXwWTk/Bl PdYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6SjORLENF92riIGeJfZ5A1xf2v8XQdFzn5b/CqTBC7s=; b=jHYooaXURuP88SyClGCvoQTseblen6GDZQ+gFCHJ2d+qWq5/3i62zsxxxzyDwIlYwl FlETXsS+x4XqdGbPpMF+IW+L9yCTEpUtbK36XNuuoymPL13SJ4Fy68/gmM17lIii1Uv7 PIH29jPxYR6SJuCOrGct5AeHLCfbrNn/t5TO4KXxZtllGvggnZT0GpnJ4l2hgSVGZ9k7 E0uGYr7mqmgsYxK7U3YuTtSAwwb59uOg8TWn0e8QyKLM/Uxs0FkR+HLJkDn72Eqb2VIo IRr6JvuRPTmapE+mao+/6YDFNFHa8j0MlrIJRENOSjG68aYQKzsv84u9riyWhUmX9V/7 wp6g== X-Gm-Message-State: AOAM531kBJ5xFX6RvjaA4oVa/Gxs/W8w80G9bn2DETkGbYyy7uMV8Uat yuLlAE9sd4RKW9U8QUK1kWv6qlUYYdSnEIhpW3W07g== X-Google-Smtp-Source: ABdhPJxd2wTKc+IYW15gwCI0FakmX2YZ2x/+bNncDfjzsSljVb7V5ro2XC3hPWZFrbKdHIZ0y3mkiZlMTlfSJBIEkqg= X-Received: by 2002:a63:480f:: with SMTP id v15mr8647704pga.341.1611139520616; Wed, 20 Jan 2021 02:45:20 -0800 (PST) MIME-Version: 1.0 References: <20210120013049.311822-1-mike.kravetz@oracle.com> <20210120013049.311822-6-mike.kravetz@oracle.com> In-Reply-To: <20210120013049.311822-6-mike.kravetz@oracle.com> From: Muchun Song Date: Wed, 20 Jan 2021 18:44:41 +0800 Message-ID: Subject: Re: [External] [PATCH v2 5/5] hugetlb: convert PageHugeFreed to HPageFreed flag To: Mike Kravetz Cc: LKML , Linux Memory Management List , Michal Hocko , Naoya Horiguchi , David Hildenbrand , Oscar Salvador , Matthew Wilcox , Andrew Morton Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jan 20, 2021 at 9:31 AM Mike Kravetz wrote: > > Use new hugetlb specific HPageFreed flag to replace the > PageHugeFreed interfaces. > > Signed-off-by: Mike Kravetz Reviewed-by: Muchun Song > --- > include/linux/hugetlb.h | 3 +++ > mm/hugetlb.c | 23 ++++------------------- > 2 files changed, 7 insertions(+), 19 deletions(-) > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index ec329b9cc0fc..8fd0970cefdb 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -487,11 +487,13 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, > * 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. > + * HPG_freed - Set when page is on the free lists. > */ > enum hugetlb_page_flags { > HPG_restore_reserve = 0, > HPG_migratable, > HPG_temporary, > + HPG_freed, > __NR_HPAGEFLAGS, > }; > > @@ -540,6 +542,7 @@ static inline void ClearHPage##uname(struct page *page) \ > HPAGEFLAG(RestoreReserve, restore_reserve) > HPAGEFLAG(Migratable, migratable) > HPAGEFLAG(Temporary, temporary) > +HPAGEFLAG(Freed, freed) > > #ifdef CONFIG_HUGETLB_PAGE > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 0d2bfc2b6adc..d5a78aedbfda 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -79,21 +79,6 @@ DEFINE_SPINLOCK(hugetlb_lock); > static int num_fault_mutexes; > struct mutex *hugetlb_fault_mutex_table ____cacheline_aligned_in_smp; > > -static inline bool PageHugeFreed(struct page *head) > -{ > - return page_private(head + 4) == -1UL; > -} > - > -static inline void SetPageHugeFreed(struct page *head) > -{ > - set_page_private(head + 4, -1UL); > -} > - > -static inline void ClearPageHugeFreed(struct page *head) > -{ > - set_page_private(head + 4, 0); > -} > - > /* Forward declaration */ > static int hugetlb_acct_memory(struct hstate *h, long delta); > > @@ -1043,7 +1028,7 @@ static void enqueue_huge_page(struct hstate *h, struct page *page) > list_move(&page->lru, &h->hugepage_freelists[nid]); > h->free_huge_pages++; > h->free_huge_pages_node[nid]++; > - SetPageHugeFreed(page); > + SetHPageFreed(page); > } > > static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) > @@ -1060,7 +1045,7 @@ static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) > > list_move(&page->lru, &h->hugepage_activelist); > set_page_refcounted(page); > - ClearPageHugeFreed(page); > + ClearHPageFreed(page); > h->free_huge_pages--; > h->free_huge_pages_node[nid]--; > return page; > @@ -1474,7 +1459,7 @@ static void prep_new_huge_page(struct hstate *h, struct page *page, int nid) > spin_lock(&hugetlb_lock); > h->nr_huge_pages++; > h->nr_huge_pages_node[nid]++; > - ClearPageHugeFreed(page); > + ClearHPageFreed(page); > spin_unlock(&hugetlb_lock); > } > > @@ -1747,7 +1732,7 @@ int dissolve_free_huge_page(struct page *page) > * We should make sure that the page is already on the free list > * when it is dissolved. > */ > - if (unlikely(!PageHugeFreed(head))) { > + if (unlikely(!HPageFreed(head))) { > rc = -EAGAIN; > goto out; > } > -- > 2.29.2 >