From patchwork Sat Jun 29 23:41:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 13717027 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 6AA06C27C4F for ; Sat, 29 Jun 2024 23:42:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB5D26B0083; Sat, 29 Jun 2024 19:42:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B3ECD6B0088; Sat, 29 Jun 2024 19:42:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B8996B0089; Sat, 29 Jun 2024 19:42:10 -0400 (EDT) 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 7DAB86B0083 for ; Sat, 29 Jun 2024 19:42:10 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F095D1A1185 for ; Sat, 29 Jun 2024 23:42:09 +0000 (UTC) X-FDA: 82285551978.27.A14FFB9 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf12.hostedemail.com (Postfix) with ESMTP id 37FDE40008 for ; Sat, 29 Jun 2024 23:42:08 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cdD9soKk; spf=pass (imf12.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=21cnbao@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=1719704509; 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:references:dkim-signature; bh=ZlOndXAQYIA/gkCwrk2GQEBTFD9obTR1n2sQ+YWZvbU=; b=QJyKHmqA4I/IMQHSyRzaXhpVy5+W+zJckFDT6wBHLMviyuep/8Nua4YSiSud+lPzlQ6lZI LrAbAUJSC/raEmhphb6Am3mz934FOrSvFbd1l4/tq9hULOWFmlgTKhJEBDpMTromWGHN7a v+NYFXXgmP1qfMgQuf57S5+L2e/5AjA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719704509; a=rsa-sha256; cv=none; b=bTZZJkBHQqouYPlrLmSwk+AQcrm6BOWiVCDjhdMw4Hmxq9Y5OIwBYdW7AxnliW/5i3HQvZ xQpeiPXsL6fBU25tqcgpwmtGe15exEb8KPnSvyE9A4cWK9PSC9gdoleeXVzCql+BEHExFa OxgY5kGjBoJEZ4126rPtdGYzuEqFZrU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cdD9soKk; spf=pass (imf12.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-70a078edb8aso713098b3a.1 for ; Sat, 29 Jun 2024 16:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719704527; x=1720309327; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZlOndXAQYIA/gkCwrk2GQEBTFD9obTR1n2sQ+YWZvbU=; b=cdD9soKkZx4Q8gRsVLXfjkubEkw98LnaieOfQu6FTJU0YS4S2OROdf7T0+0EBgtemw CfJxpXZp0a731qPvGS8mr2832eq6IVWZsHa6sq5Hft38uV3VCzsHfr9gTGj+MavcgaGj 7UKVHyxVKEfMZYTgsZm+cOtMjRsKEvVvHWuvNoTnYzcW6qs4DbKNp7FKsWkfJG4xEIvd s5V7LRSLBKSwc38yHyC9URG86vN5QWcO4ABgCDdpz1a07IIL8O4Kn7ctGJILqhNpJRhE n6b2nqo8pH0Ve0J7wdlN1INwZixzRDYooSmZXhzjJvrv2V4NxBsoLDSiUlM5SRLyyOcw wZ0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719704527; x=1720309327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZlOndXAQYIA/gkCwrk2GQEBTFD9obTR1n2sQ+YWZvbU=; b=lE3pFaXEe0w8fOWPr3tTZh1w5e30LdWFVm8XWuHdQPqfNT3qEGbhQ0BixRMn2jIS0+ lCWWmcVZaVj9UvMfy7Hf6pIvgZL/QCjtKIZbVpOcTRD+cG4z+A3iPcb3gSzGwDoLO0RL 6trOd/zckA9qZvp4Ahro/yBJkfcCuy3oWNyY1NM5uQYT3YKuHws2UpzXZKWe+ruJvfQE 9SyKXlHd9X8hMQN6ej0RUeaB+0oAVaO7NyVkYF00UDVDTRB0JvKoJrmGOJPNh6b55Kq2 ec7EjwW+f/+4F4zt0oyx62ugNe62udqdpMA2zhxi1n5GOAK9jclH31vwB9/gl8emR9m7 fNCw== X-Forwarded-Encrypted: i=1; AJvYcCV0zZLBW7M6OfoIJ4OafjPD3y6nA2N8L8zguOyKwS0DYoipDx66PX0N+V8oPdHXf1Q1sp0Q79IHPMYKN0GeJBmObCE= X-Gm-Message-State: AOJu0YwNEI3TGfoR7iGi+p7g8J11tGuFfTkd33YlWQPiTrZw9O4smKJV jxwawDB5OROUWyWbx6aeGEYESn9pFtqrjUGR5UY6gzpUcQIEp/qLTVU7ng== X-Google-Smtp-Source: AGHT+IHNvRvSLdv6mjuw6V64R4JnaBcm1WHMuRvefgESl1YG1bBt/ZuuPsKKx3UjbO2Vvrq6vxH+AQ== X-Received: by 2002:a05:6a00:8c9:b0:705:a9d9:62b1 with SMTP id d2e1a72fcca58-70aaabc0162mr3284197b3a.15.1719704526992; Sat, 29 Jun 2024 16:42:06 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7080498a021sm3760061b3a.203.2024.06.29.16.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jun 2024 16:42:06 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Barry Song , David Hildenbrand , Ryan Roberts Subject: [PATCH] mm/vmscan: drop checking if _deferred_list is empty before using TTU_SYNC Date: Sun, 30 Jun 2024 11:41:55 +1200 Message-Id: <20240629234155.53524-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 37FDE40008 X-Stat-Signature: ci36g3kzsh16mzitxjaihr1u6ais83hh X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1719704528-40979 X-HE-Meta: U2FsdGVkX1/74+GVzyOysV7SJsgzkWS8fk4mdKnXeYqlEAhEBuYx78xhYyLYdBQl1aOyP+vJETp8zERSqFSwkmamFk0kN5Vco4Figr1QxPw1Jp89P0rPe5MQ4Ylfllk+AO8hDq1memeneiVNhkMteePjEGT48tbfYTm2+uqetz1vVK2KGy8ZzcRjmab6mp6GFno9kSx7/q8BlY9FvLCnFmf3RnxU0xqTwqgrkNFYbo1C2GA2Ul0GiUSZ+C4FkMFHnak+hr58aCP4Ya6lpb229qTP3dlIy5ypkYIiYnlvOlA44X9j75SnmRGf7q5By1pnQ2Ak8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jIVZemcBVrVXKuiyjKcotPdHLMuVvLp5SBtakNCtJa+Kezyt9QulkRks0Ey/NUITAteVkewAMC1yUoJiq/6ntGQgONg+F5XpwQB0F/Y8gP+z1cbFm8u0dMPgX8aNyvW1szpPiQyU8LgV2J5/o2cmQ== 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: List-Subscribe: List-Unsubscribe: From: Barry Song The optimization of list_empty(&folio->_deferred_list) aimed to prevent increasing the PTL duration when a large folio is partially unmapped, for example, from subpage 0 to subpage (nr - 2). But Ryan's commit 5ed890ce5147 ("mm: vmscan: avoid split during shrink_folio_list()") actually splits this kind of large folios. This makes the "optimization" useless. Signed-off-by: Barry Song Cc: David Hildenbrand Cc: Ryan Roberts Reviewed-by: Ryan Roberts Reviewed-by: David Hildenbrand --- -v1 * I remember David and Ryan once suggested that this check could be dropped while the patch was being pulled into mm-unstable. However, for some reason, I forgot to request squashing this change. mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 3d4c681c6d40..0761f91b407f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1291,7 +1291,7 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, * try_to_unmap acquire PTL from the first PTE, * eliminating the influence of temporary PTE values. */ - if (folio_test_large(folio) && list_empty(&folio->_deferred_list)) + if (folio_test_large(folio)) flags |= TTU_SYNC; try_to_unmap(folio, flags);