From patchwork Wed Jan 18 23:22:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13107186 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 55B2DC38147 for ; Wed, 18 Jan 2023 23:22:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 934516B0073; Wed, 18 Jan 2023 18:22:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 86CDE6B0074; Wed, 18 Jan 2023 18:22:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7340A6B0075; Wed, 18 Jan 2023 18:22:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 66E776B0073 for ; Wed, 18 Jan 2023 18:22:26 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3FEEC4011D for ; Wed, 18 Jan 2023 23:22:26 +0000 (UTC) X-FDA: 80369495892.02.A94E76A Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf02.hostedemail.com (Postfix) with ESMTP id 9C2E080014 for ; Wed, 18 Jan 2023 23:22:24 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=eTYkEu4Q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.44 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=1674084144; 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=eqOkCPml5kLy9MKs0eQqeveAA7JccbMMg/0hsuzzSIWCE+C1n64Y1tMNf3CmYed7YigGhO oGJ6RgM6bGPRv6ytk1ZVQ+FNG+3414+gUrOk0WnnLWebh+YiIxvMEbzZakZ93Z8EvHz56d TqZBICiUXaBHxetH9bBAe4I8R8ig2rs= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=eTYkEu4Q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674084144; a=rsa-sha256; cv=none; b=m0g7UommH9z9IITnBncdoafqxJAKR6rtnbddR/EGMt0iJH4PLGd2EDVuKwpVODCXq9WJBF Ydwbk0ua+Dni5GVTJ14F7HehvKGhj6FOSUFjTTTsf0XWNaB6d4R9HvoKWF8xiIbVZKuPBf K0VXnvweQ5riuWQVjtBU+Gm1dDA+PVo= Received: by mail-pj1-f44.google.com with SMTP id s13-20020a17090a6e4d00b0022900843652so4107969pjm.1 for ; Wed, 18 Jan 2023 15:22:24 -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=eTYkEu4QWiTBpQ5PZ5ETHC6H9jjOL0AHY/mzZ+lFwdXVq1tuyLj8P3E8ewR+ImEgsN 2TKG+AYru0iFaf87vE/NcBHoRFaodj4Cq/jO5AHvjoFqicU95rVV+VCC4PEuK3cHjvzh GjJUtXwEbNPzRonxhAuHRRefgnS3GM3lnAbWbhZ0bjiRhRr1StSYxWesqcLL3iyignAo xGR7WE0QCGspcGOhpDXTO5lEolH12G/ONF8MoJTL+ZgQYmk/leR/bKANIOXBEaVBQt4W PiCDTuIL4Pqm+pTmwGQHbdrrM88Tmo/SToVqmP6+kV/l6w5fewFqt4VNShrV0AO2A3XS TJlw== 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=KoEDps7zP4hm3ClGf7Zo5FyroZn7FM7o8rMrwyg5vztofJ9gjey0d4xQV4BRhb8TBG sm13tLlIVwzmvuS6YGeo+599zf2AOLmz81YIvvgcWHuaoaV8U49RKbw9+TsmYa2U1mC3 UZ7yqFJiEWUxdmQHPrm3DKRVIUyAk1c7fPBPT33vtwHlBe75Zl2IQXYGI8OtrCTLaHyD bHwI//1QuxSFGFvYCJkTeHO0IyWdEgEnqr2jvCkrLyLma2XlhJ5CPLITTwOU8YAmUBok TQPccjbdGyYirHWZmRvA1BfSO8NHAzK5bNNL/WTeJzdn3RHRXxpvu+4oz1KfUAyYlVRb zRug== X-Gm-Message-State: AFqh2kpCHUE/xXfoDgrFyMY/6xkfBIsfn0gIjhrxiXdcGcg+7+UdruMh P4smf4MjDx+cGbnEaL1ofXzgZQUvdGI= X-Google-Smtp-Source: AMrXdXtOVaWZzLBo+o2TAej0yzsAKCSW+StQtUR8ucQfseE7GI7WjiYyBcPXOLDxSbj/hQ/ZHy51tQ== X-Received: by 2002:a17:90a:d188:b0:227:e22:4a85 with SMTP id fu8-20020a17090ad18800b002270e224a85mr9314629pjb.9.1674084143365; Wed, 18 Jan 2023 15:22:23 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 15:22:23 -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 1/5] mm/mempolicy: Convert queue_pages_pmd() to queue_folios_pmd() Date: Wed, 18 Jan 2023 15:22:15 -0800 Message-Id: <20230118232219.27038-2-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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 9C2E080014 X-Stat-Signature: oztpx167f4k39z94acejgjxd49uddop4 X-HE-Tag: 1674084144-238947 X-HE-Meta: U2FsdGVkX19yqtMWbSSt8rpAEDNlXpVDG1ZNo84H2woYYmZc7Zt7hsdQw3M9E2lmZab3Q4rgIBFyN5l7PZkI8HT5F/Q67amphUc1fLZr0J5k0Gt13qWE7eOdv6vCpdYwogHefw1IQ/GfpAIBzuvQLlj3A6+epkdXze+x0hacbBi34JUSe0NWjYZkY3zSZinYKt6CuBojY/jEX0O3EIYtPh6eXMEwkvkxUmoBbhGnFgl7Bs4MIJ5qRiBLSe4407/0LMDfxaEToQoEzt0LBOYSvRALVCXDHhraE/KJDYwEBn6xXjbanGo6bnhKUyvDAEI0ecniK9Echd0G3pXS7csYbi4F5JDIQMEpJlUSiB2RQDSyKXPUZjgVz0jubuS0omTcEGnbH95/6atpM8ziKOubyr/ZsxeZeqo9R/uuY2Pji15zDo6fNY6jY0pSOaWyzMDFV+du/kCLyxaXMgmMfVX8PiG30h/wcO7x3Nb9uL9gQnCYRSeXmiSRUFGjNwL2eClnRkP9Ff6IK9QNmdvdHoimJuvbd77XWbWlh9HI70nQfAo/a6fiwfgUz80qeP8aO5eJySxyQC+rBtaTPYzowd5Lg/n+swbd2j1echu7nTq6VpE8FY2ZcDD766PsER1CuRP8dR0JYOVAIjd8PGTPNoDgMqfA1tsHIj5oMXT3ig7uUE1lNuWtZ8K/Fnk6KpXOz9gvLdnBm3gfhZouuEqNrlinLFEQlvmv0Q1HxiYlwr2V2WWJr6Yv30RzyS487jc6XtObT6vEOwqkPh//AnRXsm2mQGM7Y8qH0rHFpjLivOvrmDrNWj3xjwKmygHl37rJ+4FdKwBCtQNys221GMAkIqfa4eM7ajDsVxvw09F8nkpa2j/i82eXt4FvtgzNo4XtO/OuGahtCCCqe2KSmMl6rWLUjywHLR7F/RteOZRvwter4xWPwJPqgg0TVECZaA5aqE2BqmPW6P5im5IAENSPPCY qC3Y6tep +MgH2fYyfXkyv04zmmR1cPoe5xEaYzJDF4XHN1y4raga98CY2oE1hcNdqTIsFqu9jdJwNsiO1Hu1/6Dyv6jWla2grVSyd69PfHnaj1tfS89qvuD6ighx+Ar6gItk+rtmI+OQKEPp6L2vXLLH6OVEswGd99plMxmmIIWwN+a+pp0pdXyFO2TgqeO5DBHhPQhIfAPtq82IGa6n/4IomvAKpl7jF07Amto+r5eX6xD23FswcOJNKRkliLtkHFPE6foT7985PX7MTJI284TD8wvxpxRv0Sw== 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;