Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1065518pxb; Fri, 26 Feb 2021 01:24:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCyX3jmaWYrVHnDCtyQBiDxgVFv8NvAHjUiboWPc7Tqd1scbLS66X7V+z43z8/SvxtlN/n X-Received: by 2002:a17:906:c102:: with SMTP id do2mr2296184ejc.305.1614331444322; Fri, 26 Feb 2021 01:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614331444; cv=none; d=google.com; s=arc-20160816; b=T66qnLqoSKzkyxiOU4ukoEI8J0y40uJ6PftD/odB1qY5NSi1gE6K3zRx4sJbQjmTvh ic6AiisGqoQUcHgRfsjMjVMoqqXdHBeaSKpFHfmsX6PHFhuoYKSb9Y4n6Yaa7hUTvAws WjoE3RLONzKGS95AfncYdb0Mml/i7qhrJwFVcnUrv1MMicPBAc9RMideiezrG84EfHTs odujwjU0qwrF9Azwjql7wmaMhyemDxlPiyMjpiK9JYJyEe4iZZDwhspdyw395v1baAps UzGXyM+MkqTl609oaxRFTWgVG7HHgMGki2k6oXqxSOKMdeVwf/2Kf7EHS9mvnJzp8zl9 OaBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=k0AsilW2lYipSpVRHZF9m6q/kGFfsp0ZK/tsphAGUXA=; b=JOWV8QwuPNYMko/ERWzBCQb22meJL2TZhYlCnsSMoFFxPekCxP+Bz8Q6elii49t+gQ QjqsgqjhtNxfnLWWU91TMbNokyE1XqoQIKVlb6vF/YRP2yzk8dhTESdA8DraAR2WUhpt kHRNzBOUp2T/03PwR+V4vGS9UCS/fbY/OQGT/9oogXCcxZZlxP3ad+7OyKqgBwtOxJUH gk7/zywBbjLKz15nSSx+n4bVnFvpHS3UvfVWvvGUPLI0OrV2kUNSqzYj8SFawT0UKCRi rXHnoMaZKD+neGg69mtkw49mWKkwhhLQZv5Hi9PSHQsS4u8KTXNEE3TxGP70Y5YNThI7 hjqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UHEC7ePp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kl24si5618126ejc.100.2021.02.26.01.23.42; Fri, 26 Feb 2021 01:24:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UHEC7ePp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230232AbhBZJUb (ORCPT + 99 others); Fri, 26 Feb 2021 04:20:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbhBZJSU (ORCPT ); Fri, 26 Feb 2021 04:18:20 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32E5BC061788 for ; Fri, 26 Feb 2021 01:17:40 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id v6so9467771ybk.9 for ; Fri, 26 Feb 2021 01:17:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=k0AsilW2lYipSpVRHZF9m6q/kGFfsp0ZK/tsphAGUXA=; b=UHEC7ePpDsJxvd5Z+OdWIwRzJX+EcAcdBJEBOYglWMs7rB+gp9uZxDQaNXeYa+ofaJ SiEpldqigfsRGuA4QBVnhtIfqzHB7PsKkXWCayrA0xA2MQHGNejP4oKuhd6tH0GSmKAb 98+hYxQYCRGa7ezb8EDKcXVFiGCnrPzid2kg4uTLKqeY2y4RIsgBh2mgjCzo8pWDL84l dbw0PXJYZIZbc+KwexI+I7CaM3cH5eWaTIOG95eknluTAh5bOxasbNCVkWjhKuEWZMOA BahRgoFguRSEXrdZAODV6x981mT424sbq7WH6yf0yHp4KYmnAw5myb0dELfiut5iPDa8 m6/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=k0AsilW2lYipSpVRHZF9m6q/kGFfsp0ZK/tsphAGUXA=; b=Og1bj6mVegM90/yM53CKCUj+DfEcWfL5k6eBsvqIOafqd3LzyoqAwPHrRWqLXYBT/G tfZqQvCi38as0YmNOTdQXhJa4f961yky8ZEiQy0haDZvWlVNc8O/tP+Tz4SImPJldVDx PcJW5f+E0l6bkzvtVppSs3lb5BvFHfZnrTwe+vNNmkYH1wRjaSyxyecgpnGIqqNZ3arn bRy6oy8T6SSqgG+aksdSiU/oqji1IKwYXR4z77CZ6jQED4/dgVZvAC/iYCwnCxKI5DaA M4k/oNESCSS5ngTIzNUqoq/cUUXBi8cbvvsu4r1W0/fubs6HDnh3sxrQqKOMf4RiExZR C1Bg== X-Gm-Message-State: AOAM533w6D6DcysvowGlwVgZmM4Se6b9ky0IVj0N1kAMZQixHrIm3Zol 7NcmC+TPBk+Mp/OUfy2TTQGPy/zP4E0= Sender: "yuzhao via sendgmr" X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:69b6:2618:c96a:ceba]) (user=yuzhao job=sendgmr) by 2002:a5b:2cb:: with SMTP id h11mr3280115ybp.428.1614331059498; Fri, 26 Feb 2021 01:17:39 -0800 (PST) Date: Fri, 26 Feb 2021 02:17:17 -0700 In-Reply-To: <20210226091718.2927291-1-yuzhao@google.com> Message-Id: <20210226091718.2927291-3-yuzhao@google.com> Mime-Version: 1.0 References: <20210224084807.2179942-1-yuzhao@google.com> <20210226091718.2927291-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [PATCH v2 2/3] mm: use PF_NO_TAIL for PG_lru From: Yu Zhao To: akpm@linux-foundation.org, alex.shi@linux.alibaba.com, vbabka@suse.cz, willy@infradead.org Cc: guro@fb.com, hannes@cmpxchg.org, hughd@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@kernel.org, vdavydov.dev@gmail.com, Yu Zhao Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Trying to set or clear PG_lru on tail pages has been considered buggy. Enforce this rule by changing the policy for PG_lru from PF_HEAD to PF_NO_TAIL. This means setting or clearing PG_lru on tail pages won't be "corrected" by compound_page(). Such "correction" isn't helpful -- even if a piece of buggy code has gotten away with compound_page(tail)->flags, it will run into trouble with lru list addition and deletion because they use tail->lru rather than compound_page(tail)->lru. bloat-o-meter result: add/remove: 0/0 grow/shrink: 0/11 up/down: 0/-535 (-535) Signed-off-by: Yu Zhao --- include/linux/page-flags.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 1995208a3763..c9626e54df8d 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -333,8 +333,8 @@ PAGEFLAG(Referenced, referenced, PF_HEAD) __SETPAGEFLAG(Referenced, referenced, PF_HEAD) PAGEFLAG(Dirty, dirty, PF_HEAD) TESTSCFLAG(Dirty, dirty, PF_HEAD) __CLEARPAGEFLAG(Dirty, dirty, PF_HEAD) -PAGEFLAG(LRU, lru, PF_HEAD) __CLEARPAGEFLAG(LRU, lru, PF_HEAD) - TESTCLEARFLAG(LRU, lru, PF_HEAD) +PAGEFLAG(LRU, lru, PF_NO_TAIL) __CLEARPAGEFLAG(LRU, lru, PF_NO_TAIL) + TESTCLEARFLAG(LRU, lru, PF_NO_TAIL) PAGEFLAG(Active, active, PF_HEAD) __CLEARPAGEFLAG(Active, active, PF_HEAD) TESTCLEARFLAG(Active, active, PF_HEAD) PAGEFLAG(Workingset, workingset, PF_HEAD) -- 2.30.1.766.gb4fecdf3b7-goog