From patchwork Thu Nov 7 23:56:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joanne Koong X-Patchwork-Id: 13867337 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 54C01D5D695 for ; Thu, 7 Nov 2024 23:56:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C3246B00AC; Thu, 7 Nov 2024 18:56:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 774626B00AD; Thu, 7 Nov 2024 18:56:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 613106B00AE; Thu, 7 Nov 2024 18:56:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 415DD6B00AC for ; Thu, 7 Nov 2024 18:56:38 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DFBC680669 for ; Thu, 7 Nov 2024 23:56:37 +0000 (UTC) X-FDA: 82760960520.18.6E8AD6D Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf21.hostedemail.com (Postfix) with ESMTP id 975B11C000E for ; Thu, 7 Nov 2024 23:55:27 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YC4U7l1D; spf=pass (imf21.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=joannelkoong@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=1731023710; 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=lr8JpF5lWbeUzT238/bHr55gxwNV9GQSeDBdKh6actU=; b=yjwSvr9ahqfqf1PmobXFVESgyv71a9Znc81gwCzDhP/W2KLHfAvkRB0CYEfYC2pvN2/IwE rOb68wZcKkwMtYtfLKIbCkj6b6BJdSy7ClCJFaLnoHutIZ+HengqIcMEoEqekQeqR5Caz4 mqGLGL5edKh03F3aLx+R2NPur9bUHy0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731023710; a=rsa-sha256; cv=none; b=VJE36DsZ/TXcdKN0ABWezbpmbu8Y/IueGBWh4i1Orq6RUrlp4PkeG0ANOpKmBOLB3io9Sd pm3zIhMtKoVEfDIYCAIMim1Ir88c1uKoBX3kceSWuszDpaYP7zfeXQpeJ6FeAGZxaK9fg2 zH52GZz0LdA2pAS9UWoYQtrehFSCtyE= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YC4U7l1D; spf=pass (imf21.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e29047bec8fso2183052276.0 for ; Thu, 07 Nov 2024 15:56:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731023795; x=1731628595; 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=lr8JpF5lWbeUzT238/bHr55gxwNV9GQSeDBdKh6actU=; b=YC4U7l1DAX2vTyRS5dWoSZC2NFFc8xsXYPt6acPimXvPXbX+r0et8Gi4EBdKTqKhe+ CisfsSIGV8x0I310HAhUqcXzVTKP0V+J1t51A+91xefNoLJOKPrA9fv0YHB2jD3bHCmV sPcK1s8JL5acYEF9oZt+j5lhJ5Q4qdMx46h9r6lkIVmlHLTaS+oj2p9VQhyLb8lGoiB2 HidasDzMZuZ6bGAB5a81LhGpsQGR3yzI2BYx//m6XPMVp9UcNtxW17+FpsAsAmFVZHHO /tk881UfI1zFcIUp4StlY4vZhgamCwjqSPMqDiwMt8Kl2bPw2caREKyH0v+JGyIVTil3 1Ymg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731023795; x=1731628595; 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=lr8JpF5lWbeUzT238/bHr55gxwNV9GQSeDBdKh6actU=; b=kcgZMi3YPdVhfSV0MoSPzARj7ds9wK0RhXgsaME2Uac4/T+E0+wXIjWssNCJeA4eiR TNjanN3VckhpkS1SVEBFU7Va8HEEooqLqSpNHDo/A3x9MYr4znLg+UERpfP4/nQaxa8B eBi7AydUI+6yD/i6p0rT8Mggp0BHZdRbBbN+10lA/wQZTSYjw+lzzW+QKqgwJdG1X2pJ HXjUBB2Tr1adGKR7DJoFmB1eQEs8JN+7VK9x5g6FVw2F7QHPr/vXIJPKAikpddar0TQq jUu7DE95ZLGnjuWw2qMgY+6zgCDyXWi6ZPO8lXBSTa+EUv7MPitpqVeLDOzGuIOGXqnc 23/w== X-Forwarded-Encrypted: i=1; AJvYcCWrktszOmHgOJ+eOEqmKlZdPh/kmbt2OciCfLKJkJGFloAGBLSBNhYfqoVe2vgzh1UCFhVLFvUGBA==@kvack.org X-Gm-Message-State: AOJu0YyWj+/MOm2CylMW+kqhnU8OFQJsaBR7sBOVVOsF6grgFnuhQsSP SPjTQZZmBhdUXoUufclwdWPHVR2ahIXzY1Sk6UFI2X8y6rJ5MXLV X-Google-Smtp-Source: AGHT+IGOIT3+Xy+DzAbYdTcJrTAKRDTg3sonybdp7wxjtEbgM1bVGNx6YfgaqkWqC5P3MjLQHVppoA== X-Received: by 2002:a05:690c:d8f:b0:6e3:ceb:9e5c with SMTP id 00721157ae682-6eade52f876mr6909907b3.17.1731023795158; Thu, 07 Nov 2024 15:56:35 -0800 (PST) Received: from localhost (fwdproxy-nha-014.fbsv.net. [2a03:2880:25ff:e::face:b00c]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6eaceb96901sm4840707b3.131.2024.11.07.15.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 15:56:34 -0800 (PST) From: Joanne Koong To: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org Cc: shakeel.butt@linux.dev, jefflexu@linux.alibaba.com, josef@toxicpanda.com, linux-mm@kvack.org, bernd.schubert@fastmail.fm, kernel-team@meta.com Subject: [PATCH v4 5/6] mm/migrate: skip migrating folios under writeback with AS_WRITEBACK_MAY_BLOCK mappings Date: Thu, 7 Nov 2024 15:56:13 -0800 Message-ID: <20241107235614.3637221-6-joannelkoong@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107235614.3637221-1-joannelkoong@gmail.com> References: <20241107235614.3637221-1-joannelkoong@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Stat-Signature: 9zpstd71ujfc7exco7bkutpq81fgdjdi X-Rspamd-Queue-Id: 975B11C000E X-Rspam-User: X-HE-Tag: 1731023727-63556 X-HE-Meta: U2FsdGVkX1+qsUf/MSqT/TUPq2eDOzFdHd3F50moXTLRGvVuw5+rRlN0e73vwPv64q9jEdKr8odjhyD3hS/UjcZIq+9YmjEt3wHkgf2OJeTm+5icm3KyC3XGLuJWT455D+Q8xGsp+xuDi9Nb7YqaO+qtMmyqyL5xbyPkW46fZ+4J0cNSsnoRoetK6OtrbUZmixSCs6ICMCdt2P2Y6BoJZHX9mg/1CPhZrenLajyu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MdS3+WcIuR+/7zx+nK4FResIJVlLa6hsKe8mLMC17cNy4PNc4NZYUn1LzXq+TPJrT3/CnBllJyjIh1RzEeRxQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000054, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: For migrations called in MIGRATE_SYNC mode, skip migrating the folio if it is under writeback and has the AS_WRITEBACK_MAY_BLOCK flag set on its mapping. If the AS_WRITEBACK_MAY_BLOCK flag is set on the mapping, the writeback may take an indeterminate amount of time to complete, so we should not wait. Signed-off-by: Joanne Koong --- mm/migrate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index df91248755e4..1d038a4202ae 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1260,7 +1260,10 @@ static int migrate_folio_unmap(new_folio_t get_new_folio, */ switch (mode) { case MIGRATE_SYNC: - break; + if (!src->mapping || + !mapping_writeback_may_block(src->mapping)) + break; + fallthrough; default: rc = -EBUSY; goto out;