From patchwork Wed Jan 18 23:22:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13107188 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 B0F33C32793 for ; Wed, 18 Jan 2023 23:22:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F37CD6B007B; Wed, 18 Jan 2023 18:22:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EB03F6B0080; Wed, 18 Jan 2023 18:22:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7A606B007D; Wed, 18 Jan 2023 18:22:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8B6726B0078 for ; Wed, 18 Jan 2023 18:22:28 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4D82E1601E5 for ; Wed, 18 Jan 2023 23:22:28 +0000 (UTC) X-FDA: 80369495976.14.D79595E Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf07.hostedemail.com (Postfix) with ESMTP id 9D0CD40021 for ; Wed, 18 Jan 2023 23:22:26 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VLVGj2Me; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 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=1674084146; 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=sR1JcCUA9O2Vny3R+G4SUtwxLVo8Eke3dTYifmkKbTA=; b=x6ZHM7Dz1ei2SF8RWNrU44BiLMXpWISBzoe6nfKmzzWd2j3iY9Ht5KNtjSSHG3wKCLlUdc 5bOgt5YRrEGqwHUgwwRRqk1nAHCcm4PuUpCBFbY5QBS5xKMxkb2u48bDPomdgF4kwyi7kD 7udCVfenpLS0nLF+QZ1b7QUkiMB0ZbQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VLVGj2Me; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 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=1674084146; a=rsa-sha256; cv=none; b=O+WLAb93olh5rhW8/YsjBnfqsqUK11p+zZUlapnyegwDcY6boGAZInfPfT9GzVXn38A2e5 rQOU0PAOk4qO+5AkiOlQYoyjzycakJjGBk0r5H42lK5fSMGb+eNTcP2rAEXZ/+Mg35u0ac zYmQ1davaYjmqV3uu59/oODC71PIQPw= Received: by mail-pl1-f178.google.com with SMTP id z13so643135plg.6 for ; Wed, 18 Jan 2023 15:22:26 -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=sR1JcCUA9O2Vny3R+G4SUtwxLVo8Eke3dTYifmkKbTA=; b=VLVGj2MeNhV4dG8tqMCOaUdWWZUjRbL/wzXS2nrU9rMdcdiWoHupAjfnkS2LZ1UIzY EIrqU/eNtw167F98QPa+DlF0ttEz6P6jzss97ZHeMD+Mnp+0o17cR9id+VKeOvQQTo3U yCYIeFH96KTFdJyLdWHN+Y55hcNZwYOVh0olOR9/ydyvrvK3SrD7Ds/NSW1Z0mk/pf2m RhJSpm+Ca0ZYRz9opt+TrOTf+OIbRsYV0dxpzVQLYDESUfHLZoFpRJy20nXvMeS7rqRO tTccJ45EBAGYT0CVJTr0FvUCBeU7cNfdMTbnxr39qIXoSZB1IxqhH3nzHofdm80Ce5K8 EJsA== 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=sR1JcCUA9O2Vny3R+G4SUtwxLVo8Eke3dTYifmkKbTA=; b=YENwxsNzV3juzkL/jBN0ck3ei4sUHUizDmrmBMb6jkd19c11F83BtYDvbLQhZYlTjX eBjjSFfjMrRTHz6d81KjDhlHOYKmjEqUmPFF4NSw+1QfOw6m0j5EjUTHdRpbKEcI2xyt KI/tJ6hA9+gemeCYdL6tCI8uJJTibCKOrljKwRxfM2kCCIOPr3xLvAgBUqWi6tEorggI JppGIJhCTy6TyCMUVaWSao3AvOreEL3R3g0b+uGFhqTheGzWVJmHYt2tLsO2EhP2PlAE B22ZSX9S+BcPp8MGfzDoKHtjT2J5OaP+OdDwCzbThcLK0Kv33aO1sO9QmT1RLUPpiOIF 4dag== X-Gm-Message-State: AFqh2ko+TFS27a73X0hClnubc0g9MdfWqfj4jL79iZJk4F7+MG1QV8Nq yhRQIw9Rg2jJmHacIJypu3HAO7pkITY= X-Google-Smtp-Source: AMrXdXt0ENl5WIQO0+QtroAVNydcvggXodDzKiNp1GCI+BCD3n+pIqAhLtX5Ca38kf6D0ROrCrVurA== X-Received: by 2002:a17:90a:2dce:b0:229:4a04:65eb with SMTP id q14-20020a17090a2dce00b002294a0465ebmr9156656pjm.31.1674084145299; Wed, 18 Jan 2023 15:22:25 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::4e4b]) by smtp.googlemail.com with ESMTPSA id k1-20020a17090a7f0100b00223f495dc28sm1862265pjl.14.2023.01.18.15.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 15:22:25 -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 3/5] mm/mempolicy: Convert queue_pages_hugetlb() to queue_folios_hugetlb() Date: Wed, 18 Jan 2023 15:22:17 -0800 Message-Id: <20230118232219.27038-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230118232219.27038-1-vishal.moola@gmail.com> References: <20230118232219.27038-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9D0CD40021 X-Stat-Signature: 44pij6iuonb4f7ejy3sto9rhs6pw3bw4 X-Rspam-User: X-HE-Tag: 1674084146-197815 X-HE-Meta: U2FsdGVkX19VPBwNpD6YtVTC/O9f4Mis2zxhUCPHkcDeL3UGgDnlWmBj3vcELBN9LLTpRVMqkl+JoiST4xtlg1aEn9w8fu2l0x7CRWDTFweq1dIGZFvGMopDmtB7gpNtIB4v+xwtqZExy6/lHAfsV+vYy/M928OdU9T5U0nTsENoX6OEPOtAKGDTQeHK7TRad5sc5PIiakcw7cjXlXEUX04w7B9mEAaTAgbjJQqJX1kmcv2Ztb/E1+pc+L3LKMt+mv85/17uV77XyY3O+/WqzlpgUpejRarlxKGHMSN8uS64qzKATYOpq7nARz99hvwObcP8zbTQzC2HwfkUNtcYdm/juVVCWEI+ZD4SxeccmQsvNvznIVvIR1UplkOeULmy5fvq2x4uFPsFwdjjV18tHXTrBlcARQpYhlgQdYJobOxOXmWXY+UB/QujnegiMsfLPgsqFrFbQrFEf+utu3fPuKcwXFHVu7CYjKB7wLJLfvglqSoxyyl8/CdlfycGFiGNxarns2DjeO2tYUdvueNeTGa7Wp2Snml7OJ3BAJDMNg47mpBqrz/dIqvOLXH/VaqhmD7rvfhbb44Y4FbWNJugYtkMj2vc273UvMhOoVPU5Kg36GKoq+53tIIcz1q+STliBPB3ssTAOhT/TxHAeqft6TqusnHPRL8oZsK/KhXgZXQ/dwBzHMM+j8Xr+l1M6qxEhvUhMumvMY8olefeINhjenbT0+BeP1ctM93zW0FlF+fhDk7OFhCMhxqzJE70ANxnEHuPRRddG5tUtjaDxsDbWFtoNnEtSkANRwRpDNH3me743EwNlGIkjP1TQAOXQS81fhjQJ83MPaGlCpJdy4Eh6eAqY24El4KeugvSGyPvwTr6udKOl+CC8e1YCTFAFy6CvRd+uIMyBTucg6lfnsG2utQfx7v+z0YqR3HmgSW6W5tQbfZkzEaSHr6qAIiL7eyNc3KmwM0BvQJZJGcX33A jc+Yo8KL t1LNCNGkNSVQeOxtT3Sl+8uUd8mUNTHfDBy497JNcQCo8KqQkNRBdA8k0ubPgh+qYuiPNAYQZrAYAYkmljtrsbUmdZXI2uNcDKPYim1jySd8LZ6EkV1pwvn7IfRPgnXwZB1xv4vExe9tmMAGBdi5m3M99JPz09+aQNHgC0q9IboVfDkjrebJN1Tp0XfkpmAIHZrsR6P9f8YVoO4Qesd3bTLe9mVJX8hQfmdInKdabOXJRcpd4pFD7iQMdAouJwlfACOPh/9lRVGs2gvY64sKR6/113Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index ae9d16124f45..0b82f8159541 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -558,7 +558,7 @@ static int queue_folios_pte_range(pmd_t *pmd, unsigned long addr, return addr != end ? -EIO : 0; } -static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask, +static int queue_folios_hugetlb(pte_t *pte, unsigned long hmask, unsigned long addr, unsigned long end, struct mm_walk *walk) { @@ -566,7 +566,7 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask, #ifdef CONFIG_HUGETLB_PAGE struct queue_pages *qp = walk->private; unsigned long flags = (qp->flags & MPOL_MF_VALID); - struct page *page; + struct folio *folio; spinlock_t *ptl; pte_t entry; @@ -574,13 +574,13 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask, entry = huge_ptep_get(pte); if (!pte_present(entry)) goto unlock; - page = pte_page(entry); - if (!queue_pages_required(page, qp)) + folio = pfn_folio(pte_pfn(entry)); + if (!queue_pages_required(&folio->page, qp)) goto unlock; if (flags == MPOL_MF_STRICT) { /* - * STRICT alone means only detecting misplaced page and no + * STRICT alone means only detecting misplaced folio and no * need to further check other vma. */ ret = -EIO; @@ -591,7 +591,7 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask, /* * Must be STRICT with MOVE*, otherwise .test_walk() have * stopped walking current vma. - * Detecting misplaced page but allow migrating pages which + * Detecting misplaced folio but allow migrating folios which * have been queued. */ ret = 1; @@ -600,11 +600,11 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask, /* With MPOL_MF_MOVE, we migrate only unshared hugepage. */ if (flags & (MPOL_MF_MOVE_ALL) || - (flags & MPOL_MF_MOVE && page_mapcount(page) == 1)) { - if (isolate_hugetlb(page_folio(page), qp->pagelist) && + (flags & MPOL_MF_MOVE && folio_mapcount(folio) == 1)) { + if (isolate_hugetlb(folio, qp->pagelist) && (flags & MPOL_MF_STRICT)) /* - * Failed to isolate page but allow migrating pages + * Failed to isolate folio but allow migrating folios * which have been queued. */ ret = 1; @@ -702,7 +702,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, + .hugetlb_entry = queue_folios_hugetlb, .pmd_entry = queue_folios_pte_range, .test_walk = queue_pages_test_walk, };