Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2344235ybk; Sun, 17 May 2020 18:24:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqS5pawIwkku+TORZ1iE/6rj6TcFd4JfOamL38PsoMU3zpEvf3iadqCzEzD+F/xEWpW9md X-Received: by 2002:a17:906:2dc8:: with SMTP id h8mr13352171eji.108.1589765065188; Sun, 17 May 2020 18:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589765065; cv=none; d=google.com; s=arc-20160816; b=s545sHUg6AJcwrmZaM3c5XLtQ07UETNjiQ2NU7o1vu9NPPdHUpOBh3skkCXgcEXtcJ S8ckjr1No1o2BrlSgbF0lv6e7nRnsBvYAnDg1HZFVOiKi96bjcDunKPSX5EEkK2HNJ1J fEHCHYKJwd/sKAWqFWaMF2pHiVroYQvJkq0ELd0R6H9lKzHs7S9E++aE2Paag48b6NH3 XnH4yKfaAJTPVqHiX5lNwXxzXwTVKImeHHN5lszS9FQxro/0n+IY3PO+N+hn90a9foLb fON2MvG7rTjxa/NX3hGk0ZVEDdZTqboKuKEnKQY8IZrfYNIUq5C4clgM5nkbPoZ5Cj+/ EEDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=ODtKSE0Od0SMbp4Vjhm8eJRPOKYNB3i5H6QmRpOi+Z0=; b=c4UifpxeBBvZT9J7X9RiYjyrCG97hYM5FUVMBHUlckOgJXvN84ZvfIx0+w68iZuSxU +dNvX49D8O9lV1nsGjdDWZ9uDl9QDiLuKHOUJ85vqjVh9bkSsP8iZ+1TAdznB07vnrwF r469weq8gHVOttaWUrEnpgQ/+ayrQ/IsI+Egp1LrefMBU2CluVqKBy8BGKSGYIXNb8Pw Q1TdtCkW9XKDpZl6Txout9sEToCKjzZRlqg5gaGrOE6vSYfMZULfjdHLT4yZy5NaOYwZ gCmyAyca1jvlLnmT0/uT7iIlXkrGhuIms1QV56A1ETYQVSq20sUSXsr/WqGwHDGAz6af REXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Wnr40su/"; 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 r1si5769559eji.355.2020.05.17.18.23.42; Sun, 17 May 2020 18:24:25 -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="Wnr40su/"; 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 S1726979AbgERBVy (ORCPT + 99 others); Sun, 17 May 2020 21:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbgERBVx (ORCPT ); Sun, 17 May 2020 21:21:53 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B8F3C061A0C for ; Sun, 17 May 2020 18:21:53 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id k19so3541388pll.9 for ; Sun, 17 May 2020 18:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ODtKSE0Od0SMbp4Vjhm8eJRPOKYNB3i5H6QmRpOi+Z0=; b=Wnr40su/PZ233GDcGfPStPxBV2EQiYtUEGGZnTd5JO6xmv/X9BLkGjHGeXutrxxxHS YBva+DZwV9iwqCPvFsTUylcaUOsiPU/yVdCcpTz2Lj8UA1oHEnrO5BZJXxG1L1WVGyrc j31GjOmdep/Rva0m5m/lqWZaraJbO+4CDuMByuXcRN7yPdq9hG/iw76CaPWtlpxgkcfd 22gzsyB/c8iFCdx76hZxl1qDNkYec+wZtKgfbBj62f1KCAyeFQZXGLvfu+GicleNPveD lyBOSmKjIWNaukH+O3wvfb/0MlrXg3UWlL9skFBmBn+9SD6zfmkrIxyReNzI2DG+GQFA FVoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ODtKSE0Od0SMbp4Vjhm8eJRPOKYNB3i5H6QmRpOi+Z0=; b=DqLJ84W9iD7XTKypH+vmGDCESB2So9nyaKpixutsSvwxh/Y+9KER41+7/P8L66h6vb pmHCdrbipWamQ1y9I0hfqvAz2SFI3JwwIUWQsbmg0XwqcJ7DKIOcgN9qktC5Vr0FRoKS dBEQnyGkrYhBNZisXZr3WWP5bFAZpeLxbTBtG89RqlxRZylNk7OgBdF54oAFgoyuo10l NQgDSvLHvUmI4hA7QuGzznaknWIslWFagcec4DeJggXlOyOvr7vXSed0tALypVLp/TWb Ly7ftIBi2puXJd4Ii9/BPh+ysBuJUhjnbeaIpmfKh42d9xVhD186Fv4/JR8SwfoFDlxH z4jg== X-Gm-Message-State: AOAM53019SVzp+2PAADG7fTXmgcfuyT89dT0Y5/O2VOakxk0av9UQXve 8oX7XnLju5fGMiV8oCIrNa8= X-Received: by 2002:a17:90a:8a06:: with SMTP id w6mr17617575pjn.191.1589764912858; Sun, 17 May 2020 18:21:52 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id fw4sm1544376pjb.31.2020.05.17.18.21.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2020 18:21:52 -0700 (PDT) From: js1304@gmail.com X-Google-Original-From: iamjoonsoo.kim@lge.com To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Vlastimil Babka , Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Michal Hocko , Joonsoo Kim Subject: [PATCH 04/11] mm/hugetlb: unify hugetlb migration callback function Date: Mon, 18 May 2020 10:20:50 +0900 Message-Id: <1589764857-6800-5-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589764857-6800-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1589764857-6800-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, @@ -755,12 +753,6 @@ static inline void huge_ptep_modify_prot_commit(struct 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(struct hstate *h, } /* page migration callback function */ -struct page *alloc_huge_page_node(struct hstate *h, - struct alloc_control *ac) -{ - struct page *page = NULL; - - ac->gfp_mask |= htlb_alloc_mask(h); - if (ac->nid != NUMA_NO_NODE) - ac->gfp_mask |= __GFP_THISNODE; - - spin_lock(&hugetlb_lock); - if (h->free_huge_pages - h->resv_huge_pages > 0) - page = dequeue_huge_page_nodemask(h, ac); - spin_unlock(&hugetlb_lock); - - if (!page) - page = 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 |= htlb_alloc_mask(h); + if (ac->thisnode && ac->nid != NUMA_NO_NODE) + ac->gfp_mask |= __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; }; #endif /* __MM_INTERNAL_H */ diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 06f60a5..629feaa 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1073,9 +1073,10 @@ struct page *alloc_new_node_page(struct page *page, unsigned long node) struct alloc_control ac = { .nid = node, .nmask = NULL, + .thisnode = true, }; - return alloc_huge_page_node(h, &ac); + return alloc_huge_page_nodemask(h, &ac); } else if (PageTransHuge(page)) { struct page *thp; -- 2.7.4