From patchwork Tue Dec 10 12:48:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 13901378 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 ADA19E7717F for ; Tue, 10 Dec 2024 12:48:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A9D46B019B; Tue, 10 Dec 2024 07:48:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 059C66B019C; Tue, 10 Dec 2024 07:48:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E641D6B019D; Tue, 10 Dec 2024 07:48:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C3B536B019B for ; Tue, 10 Dec 2024 07:48:26 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 51C8F140645 for ; Tue, 10 Dec 2024 12:48:26 +0000 (UTC) X-FDA: 82879027140.10.D25CCFA Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf24.hostedemail.com (Postfix) with ESMTP id C296F180018 for ; Tue, 10 Dec 2024 12:48:21 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TW+m6FfG; spf=pass (imf24.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=42.hyeyoo@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=1733834894; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=c7jlYSeKhyQ96j3kvuo8bzkNGKu4uK+NexRfzgF9d3M=; b=2m56eYxp8JQdUi68KQlltE73Pw1Ddl+qg1r6uanaz+h+Xj+wO1LnLyXSrBqmo3F3evNxhY Sgjkypw5vyAqyfS2faZ5tu0OgyhlCxEau83A9cEkRWpU6ITdu+ARvZaDjfnuzROqnxvUfu TlKmREF6lk+LCYanRs6cb9FllZo+X4c= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TW+m6FfG; spf=pass (imf24.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733834894; a=rsa-sha256; cv=none; b=eXeXiwl6Wp3g9y99akBBUU6c1+cJsQOV6x7RJtFKtzyjLmevao5AXIy6O3ZUvW460ZLO5Q pzwGerUsR3t7GRnlw6aKIRuHvmnoo/a0ECgjTy5uDZ0JoFL9tk6MQKDCxCSDpNaSajtq+2 AiyXfNq3FNidGhuuFZclcYwynbIG9L8= Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-725ed193c9eso1842965b3a.1 for ; Tue, 10 Dec 2024 04:48:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733834903; x=1734439703; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=c7jlYSeKhyQ96j3kvuo8bzkNGKu4uK+NexRfzgF9d3M=; b=TW+m6FfG0LJ7KBwX8vN9K3+ixpqOJOV8oyVjBiCyiSutrw40POd9rW8rvIx24V7MV8 nLwickwaAtsmFl0bxAXoF8+c8dUf4cY23M8eOfUkPHD4YWNHWVfGZEDDkkHszuTYm7A9 cjyb1Qz/kNY2wCMtXEu4PARneMq5yhRLwwJ0yGkfRt96vWKg11NYmBMlfF62Ggc+/a88 nDPOkRn2D/3KIpvVS9DD+FtsZddTAbuJEU3NcsmoJy3K9nnUa97iwfBvuJVzIqDtEprZ x0M6QP6l1kwrqVf/QvcOiKImlLcD2bpeqPdJhKAR3HWynW3z/1sLd8akV19D+t2LC91P ID/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733834903; x=1734439703; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c7jlYSeKhyQ96j3kvuo8bzkNGKu4uK+NexRfzgF9d3M=; b=T4PRobhqKp8JNINVNwN5QtpuWRMEg+NgDohU4MA8N5OvpRHTtZwo0TYBQuMCME5oG7 di7o+TiplKBKdcOrxOEbxFfQKeOAcQBw7iEH7OhdM0c8MkFqqPOVlngRYWNvpQElvSZq 1lQwvRtTT0FhE37FjqK3nJ7znwWuWOWNY4WDMOTN0JILeCAHthlnezeQFrH0LGu0FTtq vbNW2sCCv9WpDlPuSSSEi5nhxeqjGJUteoQApmXjmIU2ghEro2Nfsie8YauCgOBCkeIt bk6aUJTGhg1v6SQnnBxK85UVpWWcxv4QaBp9phZ40RgRVKd479rkwIiINjzwTEmTzQvk DACA== X-Forwarded-Encrypted: i=1; AJvYcCVax3wHgzk7kL8OgYqvYAOLcGTZwVaQvQldS+Q5qMAkyoFL6iIwK2TDe0O1X83U7nUxUZRxsrN7Hg==@kvack.org X-Gm-Message-State: AOJu0Yw/pvN81eaP34u/XpUAdPWnhrZ8lSbyssnTtFYoFBtQEUENY4Zz d5enqPuv0RP+VCw3S8W1Rb2NA/DMKRcIxS+YIp8r1hBDimap6r9n X-Gm-Gg: ASbGncsvBhhA3m51W56GLg25C3r9bZebLfNG05vHbdLTbfx/+Z7Yf8owKKXpcQR/hOG ZbhVLuNJxbtIEjk5t6AHsRqPUYhOyaq94EQkdWogXd9QvGEuNCbF/VvAma2ZL9YK0I2L5G7ScXc s2Nk5KG/wWFnT+84HgbZLb8YJkZMpSappGnAZyrisQ5i8djd2p3Cfx6hzYolYq211vyDi4raeZs WKix6iIVVc/iBg7VmC/NYnUI4AKnW6e3faWiZnRvcZu0GtoHmYuBXk27ABJZBsKtXau4riH X-Google-Smtp-Source: AGHT+IHSFPoJGP0Ml2V8hqh5JgY8n5B01IdpglP9W1SAdWNVM6qjCWoGxsjW2M1FKNcqEhxKO6B4VA== X-Received: by 2002:a05:6a21:32a4:b0:1e0:d8c1:4faf with SMTP id adf61e73a8af0-1e1b1b5199amr7392133637.28.1733834903013; Tue, 10 Dec 2024 04:48:23 -0800 (PST) Received: from hyeyoo-laptop.localdomain ([2001:2d8:690f:73f:24ea:8e6c:684e:2358]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-725c8865ee1sm6506946b3a.137.2024.12.10.04.48.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 04:48:22 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Vlastimil Babka , Matthew Wilcox , Andrew Morton , David Hildenbrand , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org Subject: [PATCH v1 mm-unstable] mm/migrate: Remove slab checks in isolate_movable_page() Date: Tue, 10 Dec 2024 21:48:07 +0900 Message-ID: <20241210124807.8584-1-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: C296F180018 X-Stat-Signature: o55c74umf77jjacbkxd8xxj9bw31hbm4 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1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FtrsxMz/6GXobYY3nes+nsW/tZ4r72e4Tml9xwihgYio+1vMZAJiAOHgGJUqT36Gea9Nljf8ULawz+VXmjc0wILKqmAKckqaTETp1ovJiwQzmikSwtTDeqO+BgiFJfh7a/AgwnXL8n+1vA+tRhJvfEBH/otKWUs3voDdHygAIZjuBtRvdpdlVLFhREx68vZidKtWeXAgDZDeWJ4uICBFLmYSyZAUmSJpknCplcOWORymEzD6oTqU5nre17xPCjj4SbydaIxhU1y+bzbAjc2hGOExNIUf+Esc15zjEJLH/+VnbGeoaXQZz7H2bT83JN+wsi2Jfwx6yOr5WxQx/IVxQx3V/beuTtGwInQ3Nm3fofhGTAJfUXcLW0V3IfbYL+sX9dqo8sX13RG3IlP6jqELhacmb0pDJopknaknUvpJIMVzdKMcTVeRdJXVpJwm80penbpyOBg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.040155, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Commit 8b8817630ae8 ("mm/migrate: make isolate_movable_page() skip slab pages") introduced slab checks to prevent mis-identification of slab pages as movable kernel pages. However, after Matthew's frozen folio series, these slab checks became unnecessary as the migration logic fails to increase the reference count for frozen slab folios. Remove these redundant slab checks and associated memory barriers. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Acked-by: David Hildenbrand Reviewed-by: Vlastimil Babka --- mm/migrate.c | 8 -------- mm/slub.c | 4 ---- 2 files changed, 12 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index e9e00d1d1d19..32cc8e0b1cce 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -68,10 +68,6 @@ bool isolate_movable_page(struct page *page, isolate_mode_t mode) if (!folio) goto out; - if (unlikely(folio_test_slab(folio))) - goto out_putfolio; - /* Pairs with smp_wmb() in slab freeing, e.g. SLUB's __free_slab() */ - smp_rmb(); /* * Check movable flag before taking the page lock because * we use non-atomic bitops on newly allocated page flags so @@ -79,10 +75,6 @@ bool isolate_movable_page(struct page *page, isolate_mode_t mode) */ if (unlikely(!__folio_test_movable(folio))) goto out_putfolio; - /* Pairs with smp_wmb() in slab allocation, e.g. SLUB's alloc_slab_page() */ - smp_rmb(); - if (unlikely(folio_test_slab(folio))) - goto out_putfolio; /* * As movable pages are not isolated from LRU lists, concurrent diff --git a/mm/slub.c b/mm/slub.c index f62c829b7b6b..ee94baba12f7 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2414,8 +2414,6 @@ static inline struct slab *alloc_slab_page(gfp_t flags, int node, slab = folio_slab(folio); __folio_set_slab(folio); - /* Make the flag visible before any changes to folio->mapping */ - smp_wmb(); if (folio_is_pfmemalloc(folio)) slab_set_pfmemalloc(slab); @@ -2636,8 +2634,6 @@ static void __free_slab(struct kmem_cache *s, struct slab *slab) __slab_clear_pfmemalloc(slab); folio->mapping = NULL; - /* Make the mapping reset visible before clearing the flag */ - smp_wmb(); __folio_clear_slab(folio); mm_account_reclaimed_pages(pages); unaccount_slab(slab, order, s);