From patchwork Wed Nov 27 08:21:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Price X-Patchwork-Id: 13887192 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 B031DD6ACF3 for ; Wed, 27 Nov 2024 16:28:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 451466B0088; Wed, 27 Nov 2024 11:28:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DA676B0089; Wed, 27 Nov 2024 11:28:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 252C06B008C; Wed, 27 Nov 2024 11:28:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 052486B0088 for ; Wed, 27 Nov 2024 11:28:46 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A2214C1B68 for ; Wed, 27 Nov 2024 16:28:46 +0000 (UTC) X-FDA: 82832408400.19.72FC5E0 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by imf02.hostedemail.com (Postfix) with ESMTP id BA76F8000E for ; Wed, 27 Nov 2024 16:28:33 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=hUKo0UKx; spf=pass (imf02.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.178 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732724918; 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=prxwR8ozRxMxxXvOfV2zxhvLnEBIflQoHb028mkGmho=; b=aeA1EtqzK9ZqDfLraxJsfJiI4Pvh2YsMiCCnLR7M1h9hB93fh3jGZUkiDzdKpvXGd5YuBZ m/dHjgDFMf0hmadF8PHluKy7/LpltuvF7BSm3F/yKfZcRfKxOOk0YxivLlyOhFOP94yqNo lj7JJHVOpHwLpJ98c+dzroyqFDDO4EQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732724918; a=rsa-sha256; cv=none; b=V5FuYe+Juk11Q9h3Hdx78tQAyZ+67apN2LgzTEo7pavoFZUj1Zgjor4bswkWqYDoHUayqF n2ZeS+wS6RCX9NkIK7E+DSnKkjliPUm1xZsKsjn/GTfyWlQi9AXPUJjH+q8Vnm8fNW5JRk 9gDTvIcX+jFmu/ZbSm5AKvmCl9qbZbQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=hUKo0UKx; spf=pass (imf02.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.178 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-46677ef6920so8899201cf.0 for ; Wed, 27 Nov 2024 08:28:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1732724924; x=1733329724; darn=kvack.org; 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=prxwR8ozRxMxxXvOfV2zxhvLnEBIflQoHb028mkGmho=; b=hUKo0UKxvkR99U8MxJQYovttP706sNOZfQ07zWjfWrqD3XKGt61YlM9zhkvkRfUuV4 BKctux5c61KMPqqn4mS1S8thIoXKRgNnE3XLdw2Sn7LBtCpVbdB4peXwFjoXGhyy+FEH AKAc5zrGBeDgfAcN3e3MvqJrNlipUdUyQ/oLxQq/UVp0ntcDkxzAnqaxV1Q7wFfjjQDu hJ/9u059IzX14zEFNQQfVU4nvZinnWp0MPKSBR2pODZeCRbjgEWXdMQdPxWi0iqCCD1o 1ugZDfCCfc/uqnFsPAJ0FHeg5piHVpiHp7znp/ke7sDZQbJiU19dBK0RQDmalrl4YH6p LEog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732724924; x=1733329724; 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=prxwR8ozRxMxxXvOfV2zxhvLnEBIflQoHb028mkGmho=; b=KFE/0dNwOBugXXIaEnT4ENsgmARGO9vIfJeX6hbi69i7rNJ6ChptegPIpEQaqtFOrP DPcDyu1OIypX9QOrM01RF1Ifaw93ofDO+0YFNRqVMKQ90V8f1DTEkTxeHNHvVlPcSiDb HE0PsxRdlFR4nTPVsJ7U4ql+FoJWGfsHhVBD4IZw+/FifN+jXZsdLR/Hkk/d8GQz8Y/U IqTNpiZCBuIlocGWb/dMFl+/f0C1Ir1UNkI2Ff+HdycYg7qATHtgBq1Wt+9KL1obXbSM OLtJICE0YHvgTqHkvpjUwVAqeqyX98ys66bTNOCDD/SY8dTivSAtqQN7ymThZL8eisSy /IGg== X-Gm-Message-State: AOJu0YzZbTmQK8dyELLpIO8sHYojEe8kdNY0UXL8Nw0nKfzWy6E2rcfM FxACIO1PYO3JiWhzosdt/VHoOdFCHEHOQO3hW2zVwewFnZgOkYDJBtay6ryHLjrof7qnPkqU+oD h X-Gm-Gg: ASbGnctzSEQX1LEfNiIAv0HeoWhh/wxyWn/PhAPvJMEPmPMA5iCvAJ+vWOijHCn7TmX kdrJ81MSn8WtFi8ScRXGHxspUQZKAYWRE4DlKSpQ23OiMxmQtmb4XaCwFNRpxV7ZKi9keOo7LbR 4pf07OHqagAlWOiWn7qOUrHt0ZGwDeme9+i0glqn5x9PFq624aGdbGGBjk6agr4meUQdZmv7wsW f7Nqc1QeW3Os7XC11NgqVheIVIAoNiJ3ipbERWegCk/IphZbz7D3Rd1Zd0Blcpo7TbLgz03ZV9C F540vhV2Vkr0IhaN7Lof8IhuHeBVtZBmE1Q= X-Google-Smtp-Source: AGHT+IEVCaFgyRliI/ntnaM1UvjIzFe3wAKf9UlR8ZwU776bFJXRF7ZXcH88bA7pVNDHWLMNqTde5w== X-Received: by 2002:ac8:59d0:0:b0:466:92e1:37e1 with SMTP id d75a77b69052e-466a3bc762emr134984061cf.26.1732724923686; Wed, 27 Nov 2024 08:28:43 -0800 (PST) Received: from PC2K9PVX.TheFacebook.com (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-466871721c2sm45002921cf.17.2024.11.27.08.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 08:28:42 -0800 (PST) From: Gregory Price To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, nehagholkar@meta.com, abhishekd@meta.com, kernel-team@meta.com, david@redhat.com, ying.huang@intel.com, nphamcs@gmail.com, gourry@gourry.net, akpm@linux-foundation.org, hannes@cmpxchg.org, feng.tang@intel.com, kbusch@meta.com Subject: [PATCH 1/4] migrate: Allow migrate_misplaced_folio APIs without a VMA Date: Wed, 27 Nov 2024 03:21:58 -0500 Message-ID: <20241127082201.1276-2-gourry@gourry.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241127082201.1276-1-gourry@gourry.net> References: <20241127082201.1276-1-gourry@gourry.net> MIME-Version: 1.0 X-Rspamd-Queue-Id: BA76F8000E X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: jyeeidw3hufgwd7kfdcrst1wwbeosihp X-HE-Tag: 1732724913-892276 X-HE-Meta: U2FsdGVkX198wG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BRc//v1lqbwELu0vzx567/oufkKDDgwZK4WMJH0YkhSY6n3lRClR4bBhhZx7fRZw6hMEZ6AaLHZeLWPNUnp0BQNhEkOfZTmgbaSnWt1Ifq+6uFa7GUtDjrWQgZKa/xrD0GfAsowE8O71qEsZGtpUUnWazupp5FvU4mgyrkzGBkGDHS7XLHQkzwzfM3EK6chA+mDRxxXbUiyH3DXsRTW6qEYP/znc4dDtW0WVgDYIzHasTjsoYORuPR3sTis3WEYOXevP5KRUiPRCkahNShmPss0eA3tPo259gjfwIl9NKrQQlXf/nGe+4Wh8WvjnA9H1/uU6Kmk X-Bogosity: Ham, tests=bogofilter, spamicity=0.004164, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: To migrate unmapped pagecache folios, migrate_misplaced_folio and migrate_misplaced_folio_prepare must handle folios without VMAs. migrate_misplaced_folio_prepare checks VMA for exec bits, so allow a NULL VMA when it does not have a mapping. migrate_misplaced_folio must call migrate_pages with MIGRATE_SYNC when in the pagecache path because it is a synchronous context. Suggested-by: Johannes Weiner Signed-off-by: Gregory Price Reviewed-by: Raghavendra K T --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index dfb5eba3c522..3b0bd3f21ac3 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2632,7 +2632,7 @@ int migrate_misplaced_folio_prepare(struct folio *folio, * See folio_likely_mapped_shared() on possible imprecision * when we cannot easily detect if a folio is shared. */ - if ((vma->vm_flags & VM_EXEC) && + if (vma && (vma->vm_flags & VM_EXEC) && folio_likely_mapped_shared(folio)) return -EACCES;