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=-6.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 D2858C433E0 for ; Thu, 21 May 2020 01:23:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 92DAE20823 for ; Thu, 21 May 2020 01:23:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="r/Jk5vrc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 92DAE20823 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 313E380008; Wed, 20 May 2020 21:23:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C3E180007; Wed, 20 May 2020 21:23:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B2A880008; Wed, 20 May 2020 21:23:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id 02E6380007 for ; Wed, 20 May 2020 21:23:05 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BC0CD8248068 for ; Thu, 21 May 2020 01:23:05 +0000 (UTC) X-FDA: 76838977530.15.house94_1afca935c3c08 X-HE-Tag: house94_1afca935c3c08 X-Filterd-Recvd-Size: 6989 Received: from mail-qv1-f65.google.com (mail-qv1-f65.google.com [209.85.219.65]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 May 2020 01:23:05 +0000 (UTC) Received: by mail-qv1-f65.google.com with SMTP id f89so2372512qva.3 for ; Wed, 20 May 2020 18:23:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=GMtVJCbEkgZEzF1ZBLwMVt1cXESOIC8nVZA92hfRjqg=; b=r/Jk5vrcSB3KOhVo3r3+GMSVZKwb4XxUm7Va/OGQ74reFpHxmw0Gaclxys3Ptme1uP UvxVu0JcGhJUPGmpbaLHLWLw9vNHFKZI6/qpCDfmM6LN/95XtsMdOTbm/dq9Hnfm7s0o MGmF1+Izrxltv0meQR5wJgbfzBsNsKiYaSwF8HjsMZAr/ZnCFXEsAfAWRAjlKMS+ma3k H3GtqGWxbe1E8U/+ZvXM2TRyP1kAf5PrKnVwEscnJLob7sIhoMt13rjzo7//vxAlETkf fegfNHIrt1dR9WkPCItxFWGBhl0ZEpJG/dwLjtpO6fsjuNJVh3YRhVcpz9kkFwMWHWdQ 3dcw== 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:content-transfer-encoding; bh=GMtVJCbEkgZEzF1ZBLwMVt1cXESOIC8nVZA92hfRjqg=; b=G+FvLlxRIGZWPr+9xtcbDNKufH2I5hF/2PbTcbY9Ds5UeCc84V/9/xqOcRJr7mIg4w CZbq8zuCcNHM+SkQNvxUEEWPH+uN0NgucvKKwwhHyDkJ9MronK3eiI2W1Sj3FaSQLHrA iaJ3yDlFrapSqfYIthzAneIo+Pa94IAdO0Dg5ZKTQ3yQ/IdGYWmVrDR0l2YDHuPcI6/R NfjCpV/xt2GUs5n5PcR8RYhy6nkKqrA3IxM7nCiT41LloILFfeHTFj3UP9UKoK1B1lpZ n624gM9jgrTLrTQz+RW5fohiOZ9NqTiq12uHhf8LgKEA+d+iGTXD+LlEMBWLjVQD04G3 SWGA== X-Gm-Message-State: AOAM533b1rV/lgwNboYbI4Wv+EMiAdL6qHe89ExypO/FlXCHg0KKlojy jXu6hRZoFaNUwUQchFAK0P6/XSM4O/u/m7TiPOY= X-Google-Smtp-Source: ABdhPJzbHRVGo23tLtEGTMcZdTYgdnp2ZMXPEnEBO/hnKIpKb0mugizf+vf4GkyhoMbTLVzY0h1wGGzK9l7+TlRzSj0= X-Received: by 2002:a0c:f3ca:: with SMTP id f10mr8036835qvm.66.1590024184723; Wed, 20 May 2020 18:23:04 -0700 (PDT) MIME-Version: 1.0 References: <1589764857-6800-1-git-send-email-iamjoonsoo.kim@lge.com> <1589764857-6800-5-git-send-email-iamjoonsoo.kim@lge.com> <20200521004608.GC317575@carbon.dhcp.thefacebook.com> In-Reply-To: <20200521004608.GC317575@carbon.dhcp.thefacebook.com> From: Joonsoo Kim Date: Thu, 21 May 2020 10:22:51 +0900 Message-ID: Subject: Re: [PATCH 04/11] mm/hugetlb: unify hugetlb migration callback function To: Roman Gushchin Cc: Andrew Morton , Linux Memory Management List , LKML , kernel-team@lge.com, Vlastimil Babka , Christoph Hellwig , Mike Kravetz , Naoya Horiguchi , Michal Hocko , Joonsoo Kim Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: 2020=EB=85=84 5=EC=9B=94 21=EC=9D=BC (=EB=AA=A9) =EC=98=A4=EC=A0=84 9:46, R= oman Gushchin =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > On Mon, May 18, 2020 at 10:20:50AM +0900, js1304@gmail.com wrote: > > From: Joonsoo Kim > > > > There is no difference between two migration callback functions, > > alloc_huge_page_node() and alloc_huge_page_nodemask(), except > > __GFP_THISNODE handling. This patch adds one more field on to > > the alloc_control and handles this exception. > > > > Signed-off-by: Joonsoo Kim > > --- > > include/linux/hugetlb.h | 8 -------- > > mm/hugetlb.c | 23 ++--------------------- > > mm/internal.h | 1 + > > mm/mempolicy.c | 3 ++- > > 4 files changed, 5 insertions(+), 30 deletions(-) > > > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > > index 6da217e..4892ed3 100644 > > --- a/include/linux/hugetlb.h > > +++ b/include/linux/hugetlb.h > > @@ -505,8 +505,6 @@ struct huge_bootmem_page { > > > > struct page *alloc_migrate_huge_page(struct hstate *h, > > struct alloc_control *ac); > > -struct page *alloc_huge_page_node(struct hstate *h, > > - struct alloc_control *ac); > > struct page *alloc_huge_page_nodemask(struct hstate *h, > > struct alloc_control *ac); > > Maybe drop _nodemask suffix in the remaining function? We cannot remove the suffix since there is already the same named function, alloc_huge_page(). > > struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_stru= ct *vma, > > @@ -755,12 +753,6 @@ static inline void huge_ptep_modify_prot_commit(st= ruct vm_area_struct *vma, > > struct hstate {}; > > > > static inline struct page * > > -alloc_huge_page_node(struct hstate *h, struct alloc_control *ac) > > -{ > > - return NULL; > > -} > > - > > -static inline struct page * > > alloc_huge_page_nodemask(struct hstate *h, struct alloc_control *ac) > > { > > return NULL; > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > > index 859dba4..60b0983 100644 > > --- a/mm/hugetlb.c > > +++ b/mm/hugetlb.c > > @@ -1981,31 +1981,12 @@ struct page *alloc_buddy_huge_page_with_mpol(st= ruct hstate *h, > > } > > > > /* page migration callback function */ > > -struct page *alloc_huge_page_node(struct hstate *h, > > - struct alloc_control *ac) > > -{ > > - struct page *page =3D NULL; > > - > > - ac->gfp_mask |=3D htlb_alloc_mask(h); > > - if (ac->nid !=3D NUMA_NO_NODE) > > - ac->gfp_mask |=3D __GFP_THISNODE; > > - > > - spin_lock(&hugetlb_lock); > > - if (h->free_huge_pages - h->resv_huge_pages > 0) > > - page =3D dequeue_huge_page_nodemask(h, ac); > > - spin_unlock(&hugetlb_lock); > > - > > - if (!page) > > - page =3D alloc_migrate_huge_page(h, ac); > > - > > - return page; > > -} > > - > > -/* page migration callback function */ > > struct page *alloc_huge_page_nodemask(struct hstate *h, > > struct alloc_control *ac) > > { > > ac->gfp_mask |=3D htlb_alloc_mask(h); > > + if (ac->thisnode && ac->nid !=3D NUMA_NO_NODE) > > + ac->gfp_mask |=3D __GFP_THISNODE; > > > > spin_lock(&hugetlb_lock); > > if (h->free_huge_pages - h->resv_huge_pages > 0) { > > diff --git a/mm/internal.h b/mm/internal.h > > index 75b3f8e..574722d0 100644 > > --- a/mm/internal.h > > +++ b/mm/internal.h > > @@ -618,6 +618,7 @@ struct alloc_control { > > int nid; > > nodemask_t *nmask; > > gfp_t gfp_mask; > > + bool thisnode; > > }; > > Can you, please, add some comments what each field exactly mean? Will do. Thanks.