From patchwork Tue Jan 24 01:22:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13113244 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 CA18FC05027 for ; Tue, 24 Jan 2023 01:22:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C9F806B0078; Mon, 23 Jan 2023 20:22:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C55166B0075; Mon, 23 Jan 2023 20:22:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E5CC6B007D; Mon, 23 Jan 2023 20:22:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8DD4A6B007B for ; Mon, 23 Jan 2023 20:22:20 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5C1E9AADF4 for ; Tue, 24 Jan 2023 01:22:20 +0000 (UTC) X-FDA: 80387942040.05.596D113 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf01.hostedemail.com (Postfix) with ESMTP id 8E28F40008 for ; Tue, 24 Jan 2023 01:22:17 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=AQFA3PSK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.179 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=1674523337; 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=stzwgsb7StErMa+MbvN56V7z1zDJ/MFHZdya+RlGC7JZb5USJEjNRu4oTFuOj6zzTTxIBL yAdyTMbzlk8na7TKGwJaF6Gwz/bCc6EskqD0g9OG1oyFVErdgMQXRf/d0GvFDMw9i6ihgI 5iCfvklvQhYHxJH15FK/F2kopXMjctQ= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=AQFA3PSK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.215.179 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674523337; a=rsa-sha256; cv=none; b=3LeG4SFlLWnuWZPXvMFCrqTkWA4WG2T4XlNPUYR3a202nymUX4BoSe60K0sUlBmVWmBrCs KVnnXhIuKglmQ8luFJtTth5lMBA2WnekFwosNMURcs/m2U2QRg5KE5KXahrrCMqHnKNhJe 1xhVQay7dv2FSXZO+m0GeuFB4TWIo1o= Received: by mail-pg1-f179.google.com with SMTP id e10so10333138pgc.9 for ; Mon, 23 Jan 2023 17:22:17 -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=AQFA3PSKomBpZe5gurflYfaoGq6UO7+JSQrD/eFXn7DBVKYwU0lAuRqrv6GxCbLet2 ZYY3M1EU7g5+hFtI0ELOwlQINs/vbumoHskfRHq5wnlvKsUF/l+Wu9dTzLGCbeC+yyLZ 1IQGEjtGmR9Qv/BmzIV6kz5BRs1XM+FvZ9xTyoltiC/Jbz7hp1uo/CqieYoyGHbCRZkV cQuSasuhjAi4VrOVZ8FspI81LB1vNTSUlHIKh4KN4Ho8vG5ViS7RiguK2VdNCAheBcmT 7yDjGx0eTBYwv9ulybCtiSf4t7DyfDQSO5+r6WLwoWyfqrKcDBphe0mryJEh58FaiuZK FTow== 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=R43mpWyajaPN7y9dgvQkep5BCdKmT4I8+fn34qLQ4ZlP+IbBOwULlZGVBod+f4rudx B6q7fYP3vHVwEmcu2iwetSiByXOGr7i37nAMhfEA+SWnPRtronuhWGLA0X1R1Fe5lxQi v+vcfsf1FSbDSB3mfDW7lz6C320TCrOEU45mNJbWWwlNOHtvqusV7ugMxm0tZJ/GVHXP Z9V3Fmf547RT4G1571D/IZqb12gsXcD/tmxTzPwFMsbWjdQDdD3LuANRdrigM9xpI3NF ldarNpyZdkY+5nyb4s8bgfxRQ3I7Q4HLWk7+RHcBkw01qCGrNIsvReiNA0vZltCAD1on C5Yg== X-Gm-Message-State: AFqh2kqLgmxva0hq7RwZ1rBCEt+pTZx5dexvsRGd385kdG9+7i3eHrT/ fn3VYnVEhg2JcCDslsyZGfn//Wn7tos= X-Google-Smtp-Source: AMrXdXuX4J13uTAEIumzs2XPLcTlVHJgPNwGg7gH1qZU0DCzEzh0s6K/AVoOfbakTeWPmmGphfpZhQ== X-Received: by 2002:aa7:96f7:0:b0:580:c223:90e9 with SMTP id i23-20020aa796f7000000b00580c22390e9mr28511220pfq.6.1674523336159; Mon, 23 Jan 2023 17:22:16 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::4e4b]) by smtp.googlemail.com with ESMTPSA id 68-20020a620547000000b005825b8e0540sm213335pff.204.2023.01.23.17.22.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 17:22:15 -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 v2 2/6] mm/mempolicy: Convert queue_pages_pmd() to queue_folios_pmd() Date: Mon, 23 Jan 2023 17:22:06 -0800 Message-Id: <20230124012210.13963-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230124012210.13963-1-vishal.moola@gmail.com> References: <20230124012210.13963-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8E28F40008 X-Stat-Signature: 8dk9ts1hsbxf9i6ahq6iunhrfcggmxsa X-HE-Tag: 1674523337-1120 X-HE-Meta: U2FsdGVkX19tOwlo8B5xsnoV7R9Mo7e9U1XLZsAgpu1oEHaAwQLbyNI13akm/X/JtBBwJ3UCRC1HrzA8IWiA+ly4/ndIfxB+ydgYtfHArciVDGYWOExWkEIOn/jIrb8ebfC/kvwgZeDm7Y5x5/F9x+oFZ1K25rvMH8BVGhMrxXT8adPCxO8uShbckJbl8nsf0MB+hDqK8zcs5hBsLGgOFzvZhghQUuUztaH8GUqekWi0mjt0KAxahktjVsVHPWYuvfyb8voHGhunD4KgFZ7aqx2bub2WP2WoXnV61Fj252YbiBGYE4kgXHL7o+HL3Zj6bi9g25Zv/SJo6EowDjWsmWRuTJ7P77NDi5swIJhiGIPs3OYwlXqQRHmbKcaU5+C/aXZzHq5ujW3Po7yYJrlIW9gxmbRSAaGrLUPGL0/c54Kjg8ar8/+6tvS+HAdvFqS6O4Q8GByk3JS1Ec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/wFBOFluVGt9QIYoDJuth38nSsfo03JkSFjOl3wksz5ulgDw== 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;