Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2319634pxu; Mon, 7 Dec 2020 03:37:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJytrGelOLpuq4j9SnhO8VZIN2AIUddCPah+oya6f8+dU0TEYSIeL9LAtH3A46JpWe9dtX55 X-Received: by 2002:a17:906:1102:: with SMTP id h2mr10398134eja.296.1607341058024; Mon, 07 Dec 2020 03:37:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607341058; cv=none; d=google.com; s=arc-20160816; b=uxCNIGmSfPpGdblw2MDBUJq0+iQSbFWabNWGwpSrUUIcXU1wxVClYhYqYuSqt3CObq ft1Ep6PmiYxTKTB72i5co5TLFX2fWaPMoOuk6juFIDOZMXAA/S+EMgqljzmrM2EyIrq4 CdIyKTyfc3S0kZF9E50IDgSHWMA4zgFY4IENNgnwd73ELugxS7MAPLJC4tOOcnyzYzr4 QmJcJZSHSeLOEyde9x051e6/fIie6AGoWt0rfnYkxtHVVDsklCfIMuYIHJO3c30gEC4y EwZf2fZRJ59sySvTM8Om5HCYm6bNqlPeedr8VJkQZyEi0jAX2ZXkFp6B9ZmEmGVBZHDV yx/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oiWdzjaw1OmADmhfyVOwsM+WBviDc5Qv5LoJ9srjCn8=; b=GtnlGcrAn8yqiUNPczA4o058ttF+7Uhv0k9xgdSDHfrQdaZCpZZbVLAmh/l7PuE00Y 6VxfPLT8ehxCblPGWK/Kkqejmy0EknXYnY+15HSrhJ8qkfQ8J0zaCyNLNP6YotY9Uzow TnSD2mwYeissDhYPYoLgcNwTa6gZjRCMgbqX3EhC7csCpj/YapUocNq2bQ/goMj9ELjz MAOUwlw8bN1dUSyqX3D85XGtFzuJKgUbh61+R8A8Xa/6juupIWa5Bl5WVZy2tzWH6PaO 4iM1BPTZNHwehejJmlEiYemEnbbBfFwQxvbTyVB2h6Q0F16lZWnbwno+8s+NpXze5K9I d8uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GojkmbMd; 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 q4si2390628eji.204.2020.12.07.03.37.14; Mon, 07 Dec 2020 03:37:38 -0800 (PST) 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=GojkmbMd; 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 S1727144AbgLGLe7 (ORCPT + 99 others); Mon, 7 Dec 2020 06:34:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727094AbgLGLe4 (ORCPT ); Mon, 7 Dec 2020 06:34:56 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85852C0613D0; Mon, 7 Dec 2020 03:34:16 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id 11so3391456pfu.4; Mon, 07 Dec 2020 03:34:16 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=oiWdzjaw1OmADmhfyVOwsM+WBviDc5Qv5LoJ9srjCn8=; b=GojkmbMdLZzqltnpM8dqoYBuO8JaFV8vAaCoFvmgCZQqrwLo0y16hu1kT/YygK2K44 QgsvracpXFSOoq10bZ7qguwwQu1ru9XSbbiMvPp7eesw75iZj6ZVQsKNtR0IjjS26QMH cFd6l1CrJHxoPJQJu6/K0t0PkR9kVQ4MSXDRj7v5lcuc0TVQB2XR1UsK6wwur1N5vxSU AwwTCEI7iBkKTY/Nxu9R233DLfjsq3wT7bb41Rt1La/5OFAq97XS6aCduvxnutsk9ctX w+0uFdcrlcAyAqvQc0wAp/QKxdlcnw+cQ5Vx+NJlV1uHfISi3iC7tddWQEiSnJWzi119 ZeCQ== 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:mime-version:content-transfer-encoding; bh=oiWdzjaw1OmADmhfyVOwsM+WBviDc5Qv5LoJ9srjCn8=; b=AyG4r3He7t8088duijeyQzhRKz0Hb+CUjMR2YFBkMOqujld3guXDn/flD4qjb3tg4g oGxxJpobdaXjtC22SshdZyAs7siZPLUbRVGziWU33RlcLVYnrnXGvB1aJe73fn63tboN p2620a4OvfbhM2ud3W6lsEALq8S+HZM9krVxTjE+G8M1CrhdUt8BOz4bZ+HXwaPD/u6d fOdusf2+DwYXuAuTeixzre+BXw7roU2hRloI1wm7mo5fMde88YnKPAvhlL8tyCx6LlXy jSsQpgDUEINbEiNyG2jbnfB8y6aYqnIXTFcRUG3A049zBqLySNP4z+fz6VTnb2gOEYSP /r+g== X-Gm-Message-State: AOAM533cCeqMe7tFwjRNZ0wRmRTo/tIn6gURBSqH8+hoMSXpe0iaf/0W n8qkQqJrZA07vTy/KQszyZ0= X-Received: by 2002:a63:ce0c:: with SMTP id y12mr18084599pgf.208.1607340856109; Mon, 07 Dec 2020 03:34:16 -0800 (PST) Received: from localhost.localdomain ([203.205.141.39]) by smtp.gmail.com with ESMTPSA id d4sm14219822pfo.127.2020.12.07.03.34.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Dec 2020 03:34:15 -0800 (PST) From: yulei.kernel@gmail.com X-Google-Original-From: yuleixzhang@tencent.com To: linux-mm@kvack.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, naoya.horiguchi@nec.com, viro@zeniv.linux.org.uk, pbonzini@redhat.com Cc: joao.m.martins@oracle.com, rdunlap@infradead.org, sean.j.christopherson@intel.com, xiaoguangrong.eric@gmail.com, kernellwp@gmail.com, lihaiwei.kernel@gmail.com, Yulei Zhang Subject: [RFC V2 11/37] mm: export mempolicy interfaces to serve dmem allocator Date: Mon, 7 Dec 2020 19:31:04 +0800 Message-Id: X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yulei Zhang Export interface interleave_nid() to serve dmem allocator. Signed-off-by: Yulei Zhang --- include/linux/mempolicy.h | 3 +++ mm/mempolicy.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 5f1c74d..4789661 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -139,6 +139,9 @@ struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, struct mempolicy *get_task_policy(struct task_struct *p); struct mempolicy *__get_vma_policy(struct vm_area_struct *vma, unsigned long addr); +struct mempolicy *get_vma_policy(struct vm_area_struct *vma, unsigned long addr); +unsigned interleave_nid(struct mempolicy *pol, struct vm_area_struct *vma, + unsigned long addr, int shift); bool vma_policy_mof(struct vm_area_struct *vma); extern void numa_default_policy(void); diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 3ca4898..efd80e5 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1813,7 +1813,7 @@ struct mempolicy *__get_vma_policy(struct vm_area_struct *vma, * freeing by another task. It is the caller's responsibility to free the * extra reference for shared policies. */ -static struct mempolicy *get_vma_policy(struct vm_area_struct *vma, +struct mempolicy *get_vma_policy(struct vm_area_struct *vma, unsigned long addr) { struct mempolicy *pol = __get_vma_policy(vma, addr); @@ -1978,7 +1978,7 @@ static unsigned offset_il_node(struct mempolicy *pol, unsigned long n) } /* Determine a node number for interleave */ -static inline unsigned interleave_nid(struct mempolicy *pol, +unsigned interleave_nid(struct mempolicy *pol, struct vm_area_struct *vma, unsigned long addr, int shift) { if (vma) { -- 1.8.3.1