From patchwork Wed Jan 25 23:41:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13116411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FBA8C61D9D for ; Wed, 25 Jan 2023 23:41:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C0646B0078; Wed, 25 Jan 2023 18:41:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 871B26B007B; Wed, 25 Jan 2023 18:41:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64EBD6B007D; Wed, 25 Jan 2023 18:41:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 570026B0078 for ; Wed, 25 Jan 2023 18:41:50 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2377880E6C for ; Wed, 25 Jan 2023 23:41:50 +0000 (UTC) X-FDA: 80394946380.07.6FF32A5 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf19.hostedemail.com (Postfix) with ESMTP id 539DC1A001A for ; Wed, 25 Jan 2023 23:41:48 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="UBtFM/nS"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674690108; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1khdYzxT7PMCcz7jBx9VZXJLxnPij2EE71ujrUVxn1A=; b=bsFQc1Vbv3d8/a5fj3jc+v1jbdkvSCNH4COAzkxCVDk4JwyKNXK8uKex/PRdmqOEjcuv71 VSrf2rVPTS47KDRWjWXkKg0yGYgTppeg9gOH5ZCvgOv8XOUgL/oDoLyKDDR8u1iNYaSbA8 iDIiAVvX1XvA+z8y1MsedWHzPlLfauI= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="UBtFM/nS"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674690108; a=rsa-sha256; cv=none; b=O06XTH/sRH2ZNMEJEeB2sw8QnWpWgPJGC8VAwvk3p9rFNjSB44dbWv3YnBYy8062cRiX6N gY/LCaaxBulhT1mBhG5c5d4MzGXZ+i2ZGrtSU4eC61ow73PD+p/oOAQWI3gJHsxCAGFB9U yPHHIKutyonPHuQPxJ3FTL1GQj9LnxY= Received: by mail-pl1-f176.google.com with SMTP id d9so421760pll.9 for ; Wed, 25 Jan 2023 15:41:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1khdYzxT7PMCcz7jBx9VZXJLxnPij2EE71ujrUVxn1A=; b=UBtFM/nSuni9xqZ8qtJkIk8LKEjARrE386v/XFm4q/6iNHXQglwU92LD/bg63vOquU XtqMQys200RkZrhJtyGKmphdie9l9Zb+gcF0lR2o2q/lBs2t6ClE41cQ5XjRo+Edpf9h F/md9YBpcoz6dthRROooSVzXlPU/MVHdUIy7JULq17/ImoUOXg3nmk8rQMNBYRjdCoFE s0Ynvr4xdLyHXZRENkORJ/T5iABEwi93EyCQsVc6yO0tidjP/AUx8OD8A94a2VejPLdP H2+pU1CayBQrjSiZzZHcZ4Az8LmDqjh5OsliDpGe4V/0lp3jnPy/iqNSK2qSaG1aZ3rI sqgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1khdYzxT7PMCcz7jBx9VZXJLxnPij2EE71ujrUVxn1A=; b=znQLbacmZ6RUcxe8joROInDAfKl/8Vf80DWuVoQGSxUtHCWNzdPBTcHoXWHHxMyuOX /oK2Db4MVd01/OxvUgh9sOTV72cLI2HTSYG/WRYwFCYNFQ2nkFdEFK4VQaAsfy6+r2ms ZL+eBVepo2PxqMavqMqpwQGYN6mFbDLran7u1NNcbCm8Nxnq4bqNf1qrOnhMHM9BRXgb bG4uwy/OBPCeM4eS5s6LXmADJB3GKPO9YRwY2Z3QGl3HF6W6Ey85z+8LSgpULOn55j5a y926Y8NdsdhLoU0ASXOLiNJcoct+n5A/GgNYPSo0abUUhiyJmX7mXAz5+efsNE6Pl8Dr qFAg== X-Gm-Message-State: AO0yUKUHOmZNpwSXav8+pfwqSZttGvKg5lvuGVnkmniWwNEh51F1rsbI 5jY2g8/IXu1d0TBb3NpHfWd/kUzx07Xqlw== X-Google-Smtp-Source: AK7set+5Nv8G0rFVsuyjEbZtPNT4sTuxT0GinYLwHib3RTjsxtB9s5pk4/OGua0gnNYq1cTWnineZg== X-Received: by 2002:a17:90a:14a5:b0:22b:b25a:d0a0 with SMTP id k34-20020a17090a14a500b0022bb25ad0a0mr4742pja.15.1674690107112; Wed, 25 Jan 2023 15:41:47 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::4e4b]) by smtp.googlemail.com with ESMTPSA id e8-20020a17090a630800b00219752c8ea5sm2226806pjj.37.2023.01.25.15.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 15:41:46 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH mm-unstable v3 2/6] mm/mempolicy: Convert queue_pages_pmd() to queue_folios_pmd() Date: Wed, 25 Jan 2023 15:41:30 -0800 Message-Id: <20230125234134.227244-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230125234134.227244-1-vishal.moola@gmail.com> References: <20230125234134.227244-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 539DC1A001A X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: iaww7q16aro5gggyryy3mq5657gjphu9 X-HE-Tag: 1674690108-810593 X-HE-Meta: U2FsdGVkX1/wjjuscXM+sgecYHuyiK2urZI6fmLEgfYC6z1fexqzOytj4GLfOlp8VXCnF/BDw+H9eKCxQJzwHojO3HRD58rJcWfPi1M/LjqLQU7Q7HsNXQ74VJT/UW/Qs+vKrLKMApj1nvQSgy7WKZ1eHbWHe98dgp6YxfMg4kpcKuKmOtjrj3epsEErIbtHbgyNbJMX+J1MoIpwwgenTx4KEth4hk3OEoktZt0dlbRMwUVA1KRDefWo6KK6LVwoXJt6V1xSws89LY8iUBst+rdREEOnUULXpv2sPIpU99K5n2iQb0RhobzdhRb3mR9jJnaUGu7JBBX7VqbFDI5eeQFq9i6lb/ukSUbZQNElevWoN/A+zVuqTp+QAcN3r+K5kL1v7+6h4RD6ChSTZwImpDBMN1/4g8YS7q5TdKd/iP4JiWJzswdFwcq9cud5V4IRzJ6gV/No19HnG3N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Hhlftwhmy+gSo83FGTpXn4a4Z8vwuhFVP2Q8699k+sBC9CR2Sfx1v3pYpHq4bPK5XcYYLk+K+hFcJXFdLji96gvpRO1ail2/AcypyJVIVtsCvQcP1tPjbr/HQLt0= 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: The function now operates on a folio instead of the page associated with a pmd. This change is in preparation for the conversion of queue_pages_required() to queue_folio_required() and migrate_page_add() to migrate_folio_add(). Signed-off-by: Vishal Moola (Oracle) --- mm/mempolicy.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index fd99d303e34f..00fffa93adae 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -442,21 +442,21 @@ static inline bool queue_pages_required(struct page *page, } /* - * queue_pages_pmd() has three possible return values: - * 0 - pages are placed on the right node or queued successfully, or + * queue_folios_pmd() has three possible return values: + * 0 - folios are placed on the right node or queued successfully, or * special page is met, i.e. huge zero page. - * 1 - there is unmovable page, and MPOL_MF_MOVE* & MPOL_MF_STRICT were + * 1 - there is unmovable folio, and MPOL_MF_MOVE* & MPOL_MF_STRICT were * specified. * -EIO - is migration entry or only MPOL_MF_STRICT was specified and an - * existing page was already on a node that does not follow the + * existing folio was already on a node that does not follow the * policy. */ -static int queue_pages_pmd(pmd_t *pmd, spinlock_t *ptl, unsigned long addr, +static int queue_folios_pmd(pmd_t *pmd, spinlock_t *ptl, unsigned long addr, unsigned long end, struct mm_walk *walk) __releases(ptl) { int ret = 0; - struct page *page; + struct folio *folio; struct queue_pages *qp = walk->private; unsigned long flags; @@ -464,19 +464,19 @@ static int queue_pages_pmd(pmd_t *pmd, spinlock_t *ptl, unsigned long addr, ret = -EIO; goto unlock; } - page = pmd_page(*pmd); - if (is_huge_zero_page(page)) { + folio = pfn_folio(pmd_pfn(*pmd)); + if (is_huge_zero_page(&folio->page)) { walk->action = ACTION_CONTINUE; goto unlock; } - if (!queue_pages_required(page, qp)) + if (!queue_pages_required(&folio->page, qp)) goto unlock; flags = qp->flags; - /* go to thp migration */ + /* go to folio migration */ if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) { if (!vma_migratable(walk->vma) || - migrate_page_add(page, qp->pagelist, flags)) { + migrate_page_add(&folio->page, qp->pagelist, flags)) { ret = 1; goto unlock; } @@ -512,7 +512,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, ptl = pmd_trans_huge_lock(pmd, vma); if (ptl) - return queue_pages_pmd(pmd, ptl, addr, end, walk); + return queue_folios_pmd(pmd, ptl, addr, end, walk); if (pmd_trans_unstable(pmd)) return 0;