From patchwork Fri Feb 26 09:17:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12106193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9D6AC433E0 for ; Fri, 26 Feb 2021 09:17:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 32A27601FC for ; Fri, 26 Feb 2021 09:17:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32A27601FC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 18C526B0073; Fri, 26 Feb 2021 04:17:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0ECA78D0002; Fri, 26 Feb 2021 04:17:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEF6F8D0001; Fri, 26 Feb 2021 04:17:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id D80D36B0073 for ; Fri, 26 Feb 2021 04:17:40 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id AED35A741 for ; Fri, 26 Feb 2021 09:17:40 +0000 (UTC) X-FDA: 77859866280.01.D24B983 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf08.hostedemail.com (Postfix) with ESMTP id CB4E580192D8 for ; Fri, 26 Feb 2021 09:17:27 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id v62so9420639ybb.15 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=niu6ITYv3nzpgQQKJLuQH37IM94JyREiTlHEKzIeGkSjvD23TcgegmMA86KgEHlUT+ WldXb9bnLaFq78oux+VR5pWB9LLL06gfKTXuUwrj75u+Bj83f08FQuFDx3rU8iBDSeAm ggdcVx4pfifohRTHuAe7LAluQfzR6MzjOD/UET/L+YHNZ3n7SNlNMwuSN6A6I2uyyFwR ibyB5EAKJ7gNg0Txjti4E/elVOpiuttR81iJFLnMF1iW8tNQjKDMqGUDKlRVYQ9abDe4 sNC4xkhvG7pBf3t4N5zcgqPD/jFz2kRrcdbpdG8xuUYaVoKBnmRe75rD0sglj2SD2tk9 Fk1A== X-Gm-Message-State: AOAM5316qGqQ5jjTmBNYJTFrbwETiPn9TPr/emLspIBUdKTeNe+wz956 jBGDm+BY9Qw2rRfKY5bOER6rFIGrqEc= X-Google-Smtp-Source: ABdhPJwIpDGfxBRdjyRoue8vq2zd8/aPXQONGuLd0v8LLbixUC5GkHVl4LonYYZAHNYpAdHhTddLH3b5xfA= 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 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CB4E580192D8 X-Stat-Signature: 8x835b75hb345k3ss1i7t3985g1c4rbc Received-SPF: none (flex--yuzhao.bounces.google.com>: No applicable sender policy available) receiver=imf08; identity=mailfrom; envelope-from="<3s7w4YAYKCBgMIN5yC4CC492.0CA96BIL-AA8Jy08.CF4@flex--yuzhao.bounces.google.com>"; helo=mail-yb1-f202.google.com; client-ip=209.85.219.202 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614331047-344153 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: 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)