From patchwork Fri Nov 15 22:44:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joanne Koong X-Patchwork-Id: 13877389 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 874EBD68BDC for ; Fri, 15 Nov 2024 22:47:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EBCB59C001A; Fri, 15 Nov 2024 17:47:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E6BBF9C0018; Fri, 15 Nov 2024 17:47:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0D6C9C001A; Fri, 15 Nov 2024 17:47:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AB8A29C0018 for ; Fri, 15 Nov 2024 17:47:02 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2A2A98012C for ; Fri, 15 Nov 2024 22:47:02 +0000 (UTC) X-FDA: 82789814520.25.B2CFC7D Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf27.hostedemail.com (Postfix) with ESMTP id 716F140009 for ; Fri, 15 Nov 2024 22:46:13 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UbQ81sPN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=joannelkoong@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731710756; a=rsa-sha256; cv=none; b=psmbAOwvPb9B/m97fZR6ysIvIkDvE5HH9/ryaW1yveftLnG9Iem0NT6C8vXrJFwRNSWOCk LxaMXgp+2C9lP6uIcU4q9u8HR8Y1Al09VVx+gWTZ3nu1DjJNQKBQDr0dVLP6/UGIebuTG4 A05XPC8vb9SudAh8VZ9qzhpm4NTDBec= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UbQ81sPN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of joannelkoong@gmail.com designates 209.85.219.181 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=1731710756; 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=sEjWA6vn5Xh3CAWPzY0RXH9AbB2HGrSJFRDx463rkA0=; b=5Dc6ut+HDwWsmeFIUVQXwFN5rgqgU2PyQ9BnZDQGZ/RFAPD5mtFEgitoeYYN2k1fQFVvO5 ewdauiQLFu3rwltf4ewgrEKSflS+87EZbKe5uM39DZ6qqn6TloedL/1vgVw3U61WAKSUm5 w4/v6ONm7o4disCUvffCe0KJkN0awRE= Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-e383bbcef9dso974916276.3 for ; Fri, 15 Nov 2024 14:47:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731710819; x=1732315619; 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=sEjWA6vn5Xh3CAWPzY0RXH9AbB2HGrSJFRDx463rkA0=; b=UbQ81sPNF42Mjq19hm/+fg4x7MUE4sQTU9VZib1Io7GRwNiojEkgTuE+kEflaldmRw nkauGbo/p+TBQ8KBSUdpVfECen88TfIzdhaSsQvPMbf5XUxHQEXykvQ52/2VHJXpGsXD ONbanwBmbjs1G0B9Aq6LKt72j9tydtjFHgEfz0no70Jrbv+bsi5hqyUk8vr7cYXp5jmP Oyf05NlvcdbyeFnwLkf9XsFo8R+qSYurme3WhuKd8sl69Tgfx42fWTgAZdnXg7BZBUl8 wXoEqcNNm1PVG3/zoqPjat7Sc6YvwzLYQcjI9EbndENPYRil4TepJqNXPM/EdOvjK37/ +Z8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731710819; x=1732315619; 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=sEjWA6vn5Xh3CAWPzY0RXH9AbB2HGrSJFRDx463rkA0=; b=cuTdtvx2WzSK4A7ygxzOBED8Yk/jyNSYvNs7fClqklb7ltESoLMS8rzhGFLT6UDG5B ZhFEvZ5eAztuzzxO4WppuPhcgho+WKNgQn6cZGoQ7aXiLDOvHzlLtOEV3AwFCjTL6/cf w+BkL+Tq2mtoPcf3O5CP4sDTVtYueRvKH8jOQNVuAH9+aRoZKcpWmJE9T+Gz1ETGDRAr BEQUpKPXoKpq3mEjQ0umQu0IVVFdaJ/5M1A367tLdkKHziH3pfTOYUdHq9BwNqNqfKqj sxj5NzBQjp3XtTv2K+v6DQk/YwO+V2tUSnVIUASg/F7EgVVOMR+OtRLgIe5neBCIQ9Ix mo3g== X-Forwarded-Encrypted: i=1; AJvYcCVAmoXpJChiqu1n5MKg1lmqr+qmsY5Tnnfw32piZU2/6Nm+y5aV0uijGZbNO9nbgJSAq4rCgSrJhw==@kvack.org X-Gm-Message-State: AOJu0Yx2nXhuTqbgsj+tGwWpZeW+/T+S9RjxutaXxYMb0m24K6iqjkYi Ckhk5JC+SJslMGwPyifR2iv+1euwIOkB8413CNoVyWRWng0IGKLCVugHdQ== X-Google-Smtp-Source: AGHT+IEkqbH2Xska95WleqplmUzi/TR1yFbkmLL2aUtOgoFdVaSIwP8XGbBOoG841NmPls+jC0AzZg== X-Received: by 2002:a05:6902:114c:b0:e33:2605:f80b with SMTP id 3f1490d57ef6-e38263f1251mr3757204276.42.1731710819349; Fri, 15 Nov 2024 14:46:59 -0800 (PST) Received: from localhost (fwdproxy-nha-005.fbsv.net. [2a03:2880:25ff:5::face:b00c]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e387e7419ffsm115897276.22.2024.11.15.14.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 14:46:59 -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 v5 4/5] mm/migrate: skip migrating folios under writeback with AS_WRITEBACK_INDETERMINATE mappings Date: Fri, 15 Nov 2024 14:44:58 -0800 Message-ID: <20241115224459.427610-5-joannelkoong@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241115224459.427610-1-joannelkoong@gmail.com> References: <20241115224459.427610-1-joannelkoong@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 716F140009 X-Rspamd-Server: rspam01 X-Stat-Signature: rcyn543rrbx6hp86ra3enqx3uf3jtb6x X-HE-Tag: 1731710773-453579 X-HE-Meta: U2FsdGVkX1+pWH4i3hvAI5I2O5LrEpovwbWir+WQucnj4gkGnCXddg8QMrMgG+n4j++HHf//lK5NSNdija7hYcT/SkBzkQE+okVwMEwSkyL2WH6YnaIzIbYs6sGbzl8N0fYIBuaclqf8biQh4xZB+Zd6oVuf1vLCr0NealDSYve2yfu+5ZO7gm52SHq+CCIcSDxIuzmOZv+/DZmDcRtpOyoR7DR9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/OoZh3IKsVCoqGacJa5KnWX66nsHRP9YPoY+wOQs+3WhOwkhBn/Yzhqo6Q6/PfHXTcmkn5jmNh3OWkXL5jeWIskbIQ1Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.016292, 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_INDETERMINATE flag set on its mapping. If the AS_WRITEBACK_INDETERMINATE flag is set on the mapping, the writeback may take an indeterminate amount of time to complete, and waits may get stuck. Signed-off-by: Joanne Koong Reviewed-by: Shakeel Butt --- mm/migrate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index df91248755e4..fe73284e5246 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_indeterminate(src->mapping)) + break; + fallthrough; default: rc = -EBUSY; goto out;