From patchwork Thu Nov 7 19:16:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joanne Koong X-Patchwork-Id: 13866972 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 542B4D5D685 for ; Thu, 7 Nov 2024 19:17:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCD7D6B009B; Thu, 7 Nov 2024 14:17:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D2F9D6B009E; Thu, 7 Nov 2024 14:17:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5F686B009B; Thu, 7 Nov 2024 14:17:46 -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 951FF6B009B for ; Thu, 7 Nov 2024 14:17:46 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5618C120B26 for ; Thu, 7 Nov 2024 19:17:46 +0000 (UTC) X-FDA: 82760257398.21.E386659 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf26.hostedemail.com (Postfix) with ESMTP id 50C6614000A for ; Thu, 7 Nov 2024 19:17:17 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fqmC5Uvi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731006939; a=rsa-sha256; cv=none; b=ZwseGUZKY3aEa6eV5RugYWauibwdUSHFK3RiWvELxQOSyJcaWtgXx4PuI2/9b/RUrhZXDX ueGtiqJi1N4UYWa3zCIOYZFl3x0Hq7yTwKT3GuknnrOl6rq9tCmQI2us8QbSJspqwvSVCf iNP2419YjwKG69DfAB75dNPXqcZ68X4= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fqmC5Uvi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731006939; 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=qgnjv1Qti3Er7P13SGfLfMjdgv5FWQIwKkbXCBxDTBDu1wb2Dqm0t/r4A6HrEHz3ITC/nQ 29/PNOqO5f70Z1CD3M6spepemiVWqm+RpGwTzc/OJHxk5dDFzbXAbJF4GSJBf8w0LaXgmX gxvEfrhQEk14INsC7b4I8VY41C1ws5M= Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-e291cbbf05bso1350672276.2 for ; Thu, 07 Nov 2024 11:17:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731007063; x=1731611863; 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=fqmC5UviiICk1IbR6a973666XRQ5v8QjWMmZGSG2tLUQTW3vO3o5EI44j7l/uVlDF3 csOjF/F6jPKedqz+N9nAsgQjxvMIcUQnszd0ySxaUd+8xlGZZr+efK1MaraKhradIG0o 9FutRNddxtm6uCcHpeuB2WDzVJdgMkGTx8EEgBi7KgMmjz2pcDCqFfJifJ2bRwxHyNT0 uZwe8HnZsScyuoK+0S54rHbR/Tu1MzUCwf92l0rPG1KHOPhfbEM+SfYIg6lLVNqbH36L VrZh30XD5Rb1nYI5m89g5H5/FQmMlwOpdCF+TAxnMmwZRmj6hRfDuiucGm+TnDoCaWN/ Tc1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731007063; x=1731611863; 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=v6IpGAC5Xy0hEXw8asRDAKkIW+bgrpC9kMys//3qFmDh4aP6+Hkez315FMpTzWbK/0 kf+B2e5cankph7AcNsZ26xpacaflB4udY6xK9yg1rJEpBAEuR3RqtO0bZy4j/6A3Rt9G EAOqfZNGhtZFYihgOfn/IFuBMKUWhmHDbLo0OZfJ3BeNOSA7s/z+xXY1ZCnx6NYxhVDr iHiO4j2Y6P7rVDi5zysmEnMTZCDgJ2eUMu1StC0Uyv2RlYInRJXisZe7GPzJ7bWGAysH q6Ir89U9LTUyYA1KN7ihOZibycGdIc8/niE9r1QEgSYINx2gNfgYik46Ssbp+/S2H2TH znbA== X-Forwarded-Encrypted: i=1; AJvYcCXR4ogOL5SiMGLSs5bhQKPI5rZmzi+xxfERgOXSSSayMUi7jnIi26inuNrQ1Yaz/QPSwgpuOWvwnw==@kvack.org X-Gm-Message-State: AOJu0Yzo/AP4vyBH5JpAAOyVhFUw3t3DtZ+Xj8pmb8iov4jkpDR1fVfH RU7/lec75NmLng0RuQkisTCoFv15L9Gclvd42uDYowCbfrefy76J X-Google-Smtp-Source: AGHT+IEbBlsb5ERr3hnSoA0jW6wUSHWc5HPhwIQVHOXGe/lfWgx6vnkhmxEOPnzB9Db6GkYOJAxRJQ== X-Received: by 2002:a05:6902:320c:b0:e29:1a7f:2f9f with SMTP id 3f1490d57ef6-e337f8d0579mr164205276.41.1731007063606; Thu, 07 Nov 2024 11:17:43 -0800 (PST) Received: from localhost (fwdproxy-nha-005.fbsv.net. [2a03:2880:25ff:5::face:b00c]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e336f1f204esm391863276.60.2024.11.07.11.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 11:17:43 -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 v3 5/6] mm/migrate: skip migrating folios under writeback with AS_WRITEBACK_MAY_BLOCK mappings Date: Thu, 7 Nov 2024 11:16:17 -0800 Message-ID: <20241107191618.2011146-7-joannelkoong@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107191618.2011146-1-joannelkoong@gmail.com> References: <20241107191618.2011146-1-joannelkoong@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 50C6614000A X-Stat-Signature: 5qweqijksrmhj9mzgxuptepp7nnqxbsf X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1731007037-785229 X-HE-Meta: U2FsdGVkX19IZkhyu4YSiNZSXAy5tDxJGQzqBgy+JtwzobyiyEef4MpTRW41YvqOwyaWkI2kIf6vix11pt4pkALoQ38wmkYirHqouUBjHPk2/4IkaquHamMgVs6Trun8HdX44f+aJW0iMh+tELYcNzo+5Bk4wR1QDWbn/tPF7DyGMMt5XsItEKAkoN3S3eQ7DPC9WPVonkFh0X8xh/DqGh7dETfB+VcoXND3pZfsyrqZ/Ed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B5gjakDdyC37cRFM2qpHrrzz/W7wiZJQEhNsPAHdeleV7XSr1WVGtDNRFjkB05gBpzgAYrlyQYER7dM+Nw== 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;