Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1005457ybk; Wed, 20 May 2020 18:25:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjVvgNeCINQxdHy46q7FfC6MCoBKx6XVTzvYqlYOvk8ICsEjR8NiFiVSLuzsYJKJSqDUxU X-Received: by 2002:a17:906:2343:: with SMTP id m3mr1449130eja.301.1590024336280; Wed, 20 May 2020 18:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590024336; cv=none; d=google.com; s=arc-20160816; b=vlF9dbXY+LFjSa3EJwrIwnsvyFW8UB709VdtdXjtIxbRncFbWrCaefnnDtwHKp3uc+ a5zR2DWIqoJFhOAWroyWt4Bm9qyjvHYyf+NKSzrmLmmfKMJQrtDUCZBbs6k8JXm0NmI6 odFGDD+N3QR/j41f2bW+7GKLdcyLGulxN1w8fy2biTUIHdOsiETis3jXLcZ+P/jMv56m 5YSog6gRGV3flUtvhUpSbm2t1h03hm4ByTlvUiGZ2rdgzyc2t3r1YCSg8Oo1Cri5otYB aD2EvHRuNMXuDzmNdYzLLWmlglj8GyYHa6V1xrUdErSidatj4HMoRJ9QGBsXTrMG+bQ9 edzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=GMtVJCbEkgZEzF1ZBLwMVt1cXESOIC8nVZA92hfRjqg=; b=WmbxzAXdErLSv4k7wQXREqXE3yKFFhvLxLctU/rlAMXnq35t5EzxmbwBk+6CAs93G4 W9rmRKplCvuLEAzdih2Rlf3j2v6OYoU1HSZJxHJsDktIj5B236zizeZM8NLCAuZxqyLy fdnYjYa1DlDiG1qHTEzikvYxSevWiLfF0XKOuaZw+31THj+Wl3kuDYWv+XJc3iXmmk/D W6fffi7FjJHsLhIsWidoiw9zvQ/CmR2udiV/yHJ9sLNQRWM2KPU8fqwDek9Twz3WN+uC FCf+fhWp8ya/SQDYTSok9U9tVpRcjZRAVoJ5YHGRurzTkLOlSEmHAEmH4W9VouGkGcc7 I4Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="r/Jk5vrc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qt28si2555358ejb.256.2020.05.20.18.25.13; Wed, 20 May 2020 18:25:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="r/Jk5vrc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728100AbgEUBXN (ORCPT + 99 others); Wed, 20 May 2020 21:23:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726933AbgEUBXG (ORCPT ); Wed, 20 May 2020 21:23:06 -0400 Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1727C061A0E for ; Wed, 20 May 2020 18:23:05 -0700 (PDT) Received: by mail-qv1-xf42.google.com with SMTP id v15so2359487qvr.8 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=OeXiSd9wOhNMOrMkHS/3YIpAeGUHUcDrQoZPx2up7HJkIwxrZSApXoqxpMigcyYLDb oWSVuMkmE66rNXN0C6VGo9ciPZldbSEN4wwAqr8iopbXXd6W+qGefXXsFtm3inEczNrB hYtjVwv5hu+1jf8vSMQ3kjCPGD0VWuc54KV3Zkd6NLBExJ/A/RHwIsdt83oOCFohJs5K ccX0h2xhfW/hl5gMcwmAn+A6VNNP8ZxsPrs43Uq9cdgfZKhItpFHSsm9ZUzltJLW6bWW 1pIhseWIEYURhB9qvG0WUHS9X/7m0XuiwxHVUSp4YYoEJARxq4i9G0bVtoQYiPJVn1RO KFyQ== X-Gm-Message-State: AOAM533hGZFt1FnvawntW1G1yuiX+A5TjrogC92ahXL6YCvsK8mGAVzD q9NAEkT6eStAWSAyqXFbpFotuviLtHlhV5cGLtI= 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.