From patchwork Wed Jan 25 23:41:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13116412 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 AF65AC54E94 for ; Wed, 25 Jan 2023 23:41:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 985616B007B; Wed, 25 Jan 2023 18:41:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FC906B0083; Wed, 25 Jan 2023 18:41:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 629586B0081; Wed, 25 Jan 2023 18:41:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4A0A86B007B for ; Wed, 25 Jan 2023 18:41:51 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 177A6C0E4B for ; Wed, 25 Jan 2023 23:41:51 +0000 (UTC) X-FDA: 80394946422.30.3CC7520 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf16.hostedemail.com (Postfix) with ESMTP id 489BE180010 for ; Wed, 25 Jan 2023 23:41:49 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Kh4RfcbG; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674690109; 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=8vZic6jN1vVBvksvwJz1xQpCGfyGjrm+SSW90x/iIgk=; b=Jh1URBlmig8te1r0wbF9kP9g9Yjf31+ur0ftNFX6YEg6Cyd7y/Noqj7osDNU55Vsn6X1kf n9xWKo+BD51zyaUHtWUxlCZzUw/8Fttohc2RnT/EiSJCbdRTrpOt/eSnlwvVHrApZutIgj DgWttXJHTjxJhERJC3jRsz2yPTxLyB4= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Kh4RfcbG; spf=pass (imf16.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674690109; a=rsa-sha256; cv=none; b=3SUkf3jccymTFMP9PetxLn+gSf78rlE88ku4ekVX5p09OkVq8N7uSMryNxgoz2S5m74V9M wthiqJFbh9tcmjfqHFanBrm46a0FUTd9W8G+L025p4IljjZyWBgKpe/9VEXcd4K8Jfwjh+ qi0A2UiNtSR6uFXkTnp9v9M0G99qa+I= Received: by mail-pj1-f50.google.com with SMTP id h5-20020a17090a9c0500b0022bb85eb35dso215707pjp.3 for ; Wed, 25 Jan 2023 15:41:49 -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=8vZic6jN1vVBvksvwJz1xQpCGfyGjrm+SSW90x/iIgk=; b=Kh4RfcbGLDn6wlmfeljol0sY1eBsJweLAeurosHOgEoNqinDlrYKhY8araOCBOa8wF I/o3DWf7ZyhOwYrBnjIJRzBu/1oB/NNffx5MEncS4Ysj8sudz0DvCcQtY9fGPeFgMfF3 gKedCJxlAVgpI44tRJIRNaoo2AD/9FsRM5z2GBhyTI2MAjFKxNDv5qbOn4GX0RlVDWbT wOIc3zu6WO9W0NW0LMVWZ/+cPSyma7Hk0MtPYdhVAYyp8QnbYyoyev+Rcuk4Y3LqRtIm OtWmcd7GqPnf+HwQ2pxmx2LZVvI6PszEEAQlIgBPp3TtL0QXQaoEbcrbEc6fAkM9ag6v nOwA== 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=8vZic6jN1vVBvksvwJz1xQpCGfyGjrm+SSW90x/iIgk=; b=jUKcLdtoZA3hmASw+nzHHCz48K84e9hVAl1/K2Uy5qlWie7Sd9R/HkxFdhecSd7Ddp xN1b+V+kCQuo3hp43F7OvrFBAvrPZvrlPMoKyEJS+tg9V3zCiAe5FqALFGJxv3NAF+UT CQSkqrZ87mp4PaIYrX6HNnsJikQW0LG4kWsaG5ni2xiNCuw4CJTPR/fsREfzkhacPImX kEJWSjdOR3H9XTEAF3mvzSwkEEzBV97B9RorvP1GXpjSOWekjcO2U/tAudofro+zBTUB D5HJjDrQLpC1Uz6vvdAk5H4oAWtt5biWlZ9NsuIF9qEqXcV8vLBeBfwZCyEAaEnbkDZY wFKw== X-Gm-Message-State: AFqh2kpXiwMqqjkUA2fA1/rNlnep/aD6h1uTZsqLFM96IJyUQBaM4JCQ 5CppgyUml56m0JKnWsi3Q+4XGi0yEQ8C7A== X-Google-Smtp-Source: AMrXdXvYkeLDgOA+420enIPeVPOV1ZMOk9RJKxRmcpIlHaghsMRa14AqSMz9s53AItO9WVuQozAWfA== X-Received: by 2002:a17:90a:7347:b0:226:b52e:f1b8 with SMTP id j7-20020a17090a734700b00226b52ef1b8mr35518920pjs.24.1674690107979; 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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 15:41:47 -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 3/6] mm/mempolicy: Convert queue_pages_pte_range() to queue_folios_pte_range() Date: Wed, 25 Jan 2023 15:41:31 -0800 Message-Id: <20230125234134.227244-4-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-Server: rspam07 X-Rspamd-Queue-Id: 489BE180010 X-Rspam-User: X-Stat-Signature: xke1h14akxzosgssmc7dqu7te4hf8zok X-HE-Tag: 1674690109-576061 X-HE-Meta: U2FsdGVkX182Dw5XokIrVj/EK/jxJuHvmGcGf5Tfkg2nPDsfa0JLgmazvecq8FGT6L4js+8FiCSpgnJnUaDSthccsnOI9ytjL2bxikhNvQ2uvND2eEkKgpIVjdRkx7BViLJxC6Kyf6UllOi3V2zyNrqwfdHFaSZBxCTRVLeQ8rkPUPqllgh2CZ90ykzI8LfgJbW8h0cLnaAeLM/RT02Yg/IuORA7JEfQGGI/kfncWYkEOByf/roKsvKQoXIFQtdM63iMs3x0LmsSmS+Zrk6izggP6iCL4gW34sdYR8XdIv45iBwA1rdtT7I/rHWiPrV4+Nt0n+qQMWs51lMztj+UgirGM+60V9ywbrgnBu53GVjsdPMUQZiO9/drbJkhSo3cCZAOgEWes1Hk3fCZkS86o5rsWAmHZgeTa6Iynv9EYmwYQxajnR4ZPalfKxN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sh+bXg8QZaWNdDA1f2JViaebm4w7dl9JKSZmSALspUDIo8mlvrtIGlN/E3bQGtTbBSmnTiGMUg== 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: This function now operates on folios associated with ptes instead of pages. 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 | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 00fffa93adae..ae9d16124f45 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -491,19 +491,19 @@ static int queue_folios_pmd(pmd_t *pmd, spinlock_t *ptl, unsigned long addr, * Scan through pages checking if pages follow certain conditions, * and move them to the pagelist if they do. * - * queue_pages_pte_range() has three possible return values: - * 0 - pages are placed on the right node or queued successfully, or + * queue_folios_pte_range() has three possible return values: + * 0 - folios are placed on the right node or queued successfully, or * special page is met, i.e. 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 - only MPOL_MF_STRICT was specified and an existing page was already + * -EIO - only MPOL_MF_STRICT was specified and an existing folio was already * on a node that does not follow the policy. */ -static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, +static int queue_folios_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, struct mm_walk *walk) { struct vm_area_struct *vma = walk->vma; - struct page *page; + struct folio *folio; struct queue_pages *qp = walk->private; unsigned long flags = qp->flags; bool has_unmovable = false; @@ -521,16 +521,16 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, for (; addr != end; pte++, addr += PAGE_SIZE) { if (!pte_present(*pte)) continue; - page = vm_normal_page(vma, addr, *pte); - if (!page || is_zone_device_page(page)) + folio = vm_normal_folio(vma, addr, *pte); + if (!folio || folio_is_zone_device(folio)) continue; /* - * vm_normal_page() filters out zero pages, but there might - * still be PageReserved pages to skip, perhaps in a VDSO. + * vm_normal_folio() filters out zero pages, but there might + * still be reserved folios to skip, perhaps in a VDSO. */ - if (PageReserved(page)) + if (folio_test_reserved(folio)) continue; - if (!queue_pages_required(page, qp)) + if (!queue_pages_required(&folio->page, qp)) continue; if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) { /* MPOL_MF_STRICT must be specified if we get here */ @@ -544,7 +544,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, * temporary off LRU pages in the range. Still * need migrate other LRU pages. */ - if (migrate_page_add(page, qp->pagelist, flags)) + if (migrate_page_add(&folio->page, qp->pagelist, flags)) has_unmovable = true; } else break; @@ -703,7 +703,7 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end, static const struct mm_walk_ops queue_pages_walk_ops = { .hugetlb_entry = queue_pages_hugetlb, - .pmd_entry = queue_pages_pte_range, + .pmd_entry = queue_folios_pte_range, .test_walk = queue_pages_test_walk, };