Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1040682pxj; Thu, 17 Jun 2021 20:58:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/08gHeWa5zEKCdAU0laM1sxuMzb+7xblFLVVTNJ0G7KQFQm3Mw3yTsghIuNo2S1ItSqPx X-Received: by 2002:a17:906:1815:: with SMTP id v21mr8739148eje.376.1623988719557; Thu, 17 Jun 2021 20:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623988719; cv=none; d=google.com; s=arc-20160816; b=dhLppPUN+vGNNPbpEByoCTC2wf7qtNAyv1Hm5c+//sZupNpfIzH3M6CrGFXqXIgDtF FarxVbo1n+pdaa0ttICCeO2R5rEqfdNDTVkcIZHAkDJkWHeZMee9xDz9DsBcMPtkS4u5 brmBJGNnIQd47aX4yjpTMHCpz1Om8kFZEVieYX9Lu3Ob4lwuSfLdtVR/7VqEo+YvWwT6 LAY1YPvoIzedPyxknQkDY2fukzFViPL3YVdyJWhTR1P1KtcF3EK1OuYjqF/6/4FOpGP4 fhZhX9rI3tx4xuUmT1XUfioguR5ToA/3HbYfMCdXqqB3cmVdV7I6LpnLSCeEb84p/lKU 7AjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=ZuGErAo31eITMujUQZ9RPBRrGfPDy4SxENK6Pd4bbIU=; b=ENp3BrEOYovQPC2XL87+Da/StUy5N5f2dCzWDWkidNot/VyTTfPHu+WwzCUmp4aWCC JAY5b60x3AaLQA2f1kMqI0qtzmvWGYNJxP6LYikUoDSr6nAdF94oeBfqu3yTlYfhofQ/ QRgxqlqiDFhuf6UjZ+4FQYp+zr/+Qb2FmbP6eSvYdDqR6S8xUraC4vMcDVp530VDeaVh eaIbE1JobZSfK5PfbmKaSSAcFllWUIj9+Y9GxTkAnE2+lomRSnyV65I0leIaHKT4VN9D KNuLp02uD/wU00dUwrGkwQjPUrt5cDCmM478O305yKomchxzkUTaYuNT5t3vF/rzO0l/ lgKw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v7si8933057edj.541.2021.06.17.20.58.17; Thu, 17 Jun 2021 20:58:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbhFRDrL (ORCPT + 99 others); Thu, 17 Jun 2021 23:47:11 -0400 Received: from mga06.intel.com ([134.134.136.31]:1056 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbhFRDrK (ORCPT ); Thu, 17 Jun 2021 23:47:10 -0400 IronPort-SDR: u1sYw/vUODM0lHwXpK0Wh0CXq+4CmSgYW0r1kjLrKd9/B8BSc9343mLTqpsdQ+QZl0uibZs6bx lCsas/Wzoh2g== X-IronPort-AV: E=McAfee;i="6200,9189,10018"; a="267636033" X-IronPort-AV: E=Sophos;i="5.83,281,1616482800"; d="scan'208";a="267636033" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2021 20:45:02 -0700 IronPort-SDR: APnfItg5ysWfcPVObQ0YruQPbopM7gCClGv2wkJQNQG0c8GwLD2o2wzOrRx+6Br9IzmfgHOfsl 7csPe3W1MI7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,281,1616482800"; d="scan'208";a="485539846" Received: from shbuild999.sh.intel.com ([10.239.147.94]) by orsmga001.jf.intel.com with ESMTP; 17 Jun 2021 20:44:57 -0700 From: Feng Tang To: linux-mm@kvack.org, Andrew Morton , Michal Hocko , David Rientjes , Dave Hansen , Ben Widawsky Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Andrea Arcangeli , Mel Gorman , Mike Kravetz , Randy Dunlap , Vlastimil Babka , Andi Kleen , Dan Williams , ying.huang@intel.com, Feng Tang Subject: [PATCH v5 -mm 3/6] mm/mempolicy: enable page allocation for MPOL_PREFERRED_MANY for general cases Date: Fri, 18 Jun 2021 11:44:41 +0800 Message-Id: <1623987884-43576-4-git-send-email-feng.tang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1623987884-43576-1-git-send-email-feng.tang@intel.com> References: <1623987884-43576-1-git-send-email-feng.tang@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Widawsky In order to support MPOL_PREFERRED_MANY which is used by set_mempolicy(2), mbind(2), enable both alloc_pages() and alloc_pages_vma() by using alloc_page_preferred_many(). Signed-off-by: Ben Widawsky Signed-off-by: Feng Tang --- mm/mempolicy.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index d17bf018efcc..9dce67fc9bb6 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2207,6 +2207,12 @@ struct page *alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, goto out; } + if (pol->mode == MPOL_PREFERRED_MANY) { + page = alloc_page_preferred_many(gfp, order, pol); + mpol_cond_put(pol); + goto out; + } + if (unlikely(IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && hugepage)) { int hpage_node = node; @@ -2286,6 +2292,8 @@ struct page *alloc_pages(gfp_t gfp, unsigned order) */ if (pol->mode == MPOL_INTERLEAVE) page = alloc_page_interleave(gfp, order, interleave_nodes(pol)); + else if (pol->mode == MPOL_PREFERRED_MANY) + page = alloc_page_preferred_many(gfp, order, pol); else page = __alloc_pages(gfp, order, policy_node(gfp, pol, numa_node_id()), -- 2.7.4