Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1373496pxb; Fri, 22 Jan 2021 14:10:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwogFI5NVpYbQFQfqkcaY5LYLX+3fMb0iCrRP5wPqzNY/PgZV98yW/nLUzfryUW7xrnwwOt X-Received: by 2002:a05:6402:35ca:: with SMTP id z10mr4919118edc.186.1611353437574; Fri, 22 Jan 2021 14:10:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611353437; cv=none; d=google.com; s=arc-20160816; b=NL+ws+4vcbdQRnq5brtCu8/e19/YHhFe8/wy+OcfqRbW4qccMHJoWsA6292fvyLK1t h6tYmP5qs5ppJBgdbSZMzLL9e8AgmKoLwhN4RkmUIfYDN5ZgPqjPi5pm0FzquKPq0HR8 tBRPdS5yE0UIkLFYs3eREu8vZJoomwgLfDtI8Y2OyXnQSJYZjSdRtQnftwIvHcXm+Gfd pJdiOFD2QFrXdAYCHhFoVDBgJJA0++6+f2Al5YljIu8KWP0iaWA7W4qCoT3Lf4SBy2y2 4gj4rct5WMUtLWi8ppx0FVQZVnlKJC2iXWcUmCtn0TWGUiEKgm3HJWP/jPLVDp1ITZre 7oIw== 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:mime-version:message-id:date :sender:dkim-signature; bh=v825TuBJU359gqimRLyU0L4kx6zR5e87EOsaxQ3/+pY=; b=Jci6MTFvEI2ob9btQXZ5VZ7FGLj+vW+HTfugfuc2Jf347fjWYVVqvi0eAD0NyJzwo3 +nk+NLTCilX3jLwHX3w/Dacmn+e3zHqNaj7qcUiVGUhHDth1hPYUsdTtypsdxSqGUwLg V2px6RjMwKnb5my3ioF0anvgpgph7/RLZDaRijTQ+PFJfCH6abP6o9PKmFLQ2QEW/2XP RaEKSLVYZfLRAHDUyZmgm2vZH2Syj1TRzgqkXoNassRVRyOwXhaI2Q09oTZBXMFU8nEp RYh4RiyiGJBa8Z7hCAXKviLPXBPIZDP1aVnlodVAeMfAa6w6qxnlqw1C7nYmmBUFmgT0 ByeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="vX1/VB6O"; 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 dp21si3378725ejc.108.2021.01.22.14.10.13; Fri, 22 Jan 2021 14:10:37 -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="vX1/VB6O"; 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 S1730788AbhAVWHo (ORCPT + 99 others); Fri, 22 Jan 2021 17:07:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727354AbhAVWGo (ORCPT ); Fri, 22 Jan 2021 17:06:44 -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 9D49DC06174A for ; Fri, 22 Jan 2021 14:06:03 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id k33so6848277ybj.14 for ; Fri, 22 Jan 2021 14:06:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=v825TuBJU359gqimRLyU0L4kx6zR5e87EOsaxQ3/+pY=; b=vX1/VB6OOOfUKCNJCysnx2cH3bEfyD11W9g28UBKgMxrU+mRNFPZVqAkpplFzOdE74 5q5Ht10jKYI1z43rwA7vx/VUajqbwddShlGhUWcGEFtYslzjALozvAzzq78DZN8Cy8Vi NziDfiYZLpiXANXhIjZlCLxHLgMpAG0wpjefHOOvx+hKzbeQEeGCkzM/hhfU4KWfYJIX IeMWn/h81ShrunphLQOlPmlFo9LaJP7PUABjBre4jDlA2+r3Lok0rtZtJdQvP9LikCyP B7dEojxmXoRiDSSGjGwxXgqOsTLaDksKqiiwDERgNNJ+N30jq3w4UufK/juMzcDgrQOv +5GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=v825TuBJU359gqimRLyU0L4kx6zR5e87EOsaxQ3/+pY=; b=m1Eqrmhjml8lyQR6PzkMECancLZtVdwDJWAPacvTur9v/IPw5OqhTL/vEk9STsgy8E 3Lcqi9wc9gUtINVhSFgvHlGym5mWNKjUAiVE43IOiu1Rg0kZlUhUM0NxtezfcIdVK8hJ zgZBMJ+tgsB7D7nAeZY4P46crfCcrUJPv/atxLH6eKca++9yvvBKh0eQ1lqKx55NzcrR kB1lz3vnt1M2sJTJJ9aamqPd/c1Z5TepXxexiXpah1HD1eikypGA/ASJwg6wbSkXJplD kI602PwRDXCwtDqh7LuHl+NAMan1606gs6gTPThPv9UVD0yg/FL+2FJQJt5tx23yQymb ydxQ== X-Gm-Message-State: AOAM533zCsiJXDKXPX6I+pVbbMx4mdk4Ci64z0ybqI1PNqP7fkCtl30t 9MgI4uwBCO3pPke4uMdRGZHIf7RoU0s= Sender: "yuzhao via sendgmr" X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a25:2a86:: with SMTP id q128mr10168393ybq.387.1611353162833; Fri, 22 Jan 2021 14:06:02 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:50 -0700 Message-Id: <20210122220600.906146-1-yuzhao@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 00/10] mm: lru related cleanups From: Yu Zhao To: Andrew Morton , Hugh Dickins , Alex Shi Cc: Michal Hocko , Johannes Weiner , Vladimir Davydov , Roman Gushchin , Vlastimil Babka , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cleanups are intended to reduce the verbosity in lru list operations and make them less error-prone. A typical example would be how the patches change __activate_page(): static void __activate_page(struct page *page, struct lruvec *lruvec) { if (!PageActive(page) && !PageUnevictable(page)) { - int lru = page_lru_base_type(page); int nr_pages = thp_nr_pages(page); - del_page_from_lru_list(page, lruvec, lru); + del_page_from_lru_list(page, lruvec); SetPageActive(page); - lru += LRU_ACTIVE; - add_page_to_lru_list(page, lruvec, lru); + add_page_to_lru_list(page, lruvec); trace_mm_lru_activate(page); There are a few more places like __activate_page() and they are unnecessarily repetitive in terms of figuring out which list a page should be added onto or deleted from. And with the duplicated code removed, they are easier to read, IMO. Patch 1 to 5 basically cover the above. Patch 6 and 7 make code more robust by improving bug reporting. Patch 8, 9 and 10 take care of some dangling helpers left in header files. v1 -> v2: dropped the last patch in this series based on the discussion here: https://lore.kernel.org/patchwork/patch/1350552/#1550430 Yu Zhao (10): mm: use add_page_to_lru_list() mm: shuffle lru list addition and deletion functions mm: don't pass "enum lru_list" to lru list addition functions mm: don't pass "enum lru_list" to trace_mm_lru_insertion() mm: don't pass "enum lru_list" to del_page_from_lru_list() mm: add __clear_page_lru_flags() to replace page_off_lru() mm: VM_BUG_ON lru page flags mm: fold page_lru_base_type() into its sole caller mm: fold __update_lru_size() into its sole caller mm: make lruvec_lru_size() static include/linux/mm_inline.h | 113 ++++++++++++++------------------- include/linux/mmzone.h | 2 - include/trace/events/pagemap.h | 11 ++-- mm/compaction.c | 2 +- mm/mlock.c | 3 +- mm/swap.c | 50 ++++++--------- mm/vmscan.c | 21 ++---- 7 files changed, 77 insertions(+), 125 deletions(-) -- 2.30.0.280.ga3ce27912f-goog