From patchwork Fri Jan 22 22:05:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040721 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.6 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 1EFF9C433E6 for ; Fri, 22 Jan 2021 22:06:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 928E123B06 for ; Fri, 22 Jan 2021 22:06:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 928E123B06 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 15A3E6B0008; Fri, 22 Jan 2021 17:06:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 10A936B000A; Fri, 22 Jan 2021 17:06:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E78466B000C; Fri, 22 Jan 2021 17:06:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0046.hostedemail.com [216.40.44.46]) by kanga.kvack.org (Postfix) with ESMTP id CCCD86B0008 for ; Fri, 22 Jan 2021 17:06:05 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 93BFB81F6 for ; Fri, 22 Jan 2021 22:06:05 +0000 (UTC) X-FDA: 77734794690.11.jump70_350060b2756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 5C12A1822070A for ; Fri, 22 Jan 2021 22:06:05 +0000 (UTC) X-HE-Tag: jump70_350060b2756f X-Filterd-Recvd-Size: 4373 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:04 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id l3so6874825ybl.17 for ; Fri, 22 Jan 2021 14:06:04 -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=c4ouleZZAXyP3qydY74TQhV9ZSx17hh5bTzcAWO3/yk=; b=LJ4Yix2VskMpUEhAiL78cfZDxjzB/3aVHbtqNdaziJ2e9O7HzLZEr38cde4kZMqjhI w5XeiPekl7yVlhUlraMHTPWWN1AhSAlrfyqaspcro3faG4B9iIiZSJAbJtILO+ygDVwB giQmTZR1OqfJlHyBot2M7xj9v71DHuqhkqYlnNLt4fffp/BqeSiCeVM6CMTV+pWmWncS 8qjn3JbHZ3vs2mIgq/AcGnsHz6iyYQBB3vU2s+mMiiAxK46mNO0mCRKTDQLDeJqLi32L TVdotZnoY2YRgunsmJDQi3x2Ez0bRd5w7HwtJo8NG7waS5Tetq/8a1vUnArVT0kqXfRE eb0Q== 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=c4ouleZZAXyP3qydY74TQhV9ZSx17hh5bTzcAWO3/yk=; b=H7QYbJRQb8Lc48spSfBa1btkPrgLFV2z0Z+NyyDr183N6evKwKSv9tZyNW7Y77CKTG 9pG4CsBsFQyG7OJ4AB3kss8hBXTR1sk2vN/CbK/myLdhC/6ZJMZyKqDIHv24yQGAMaoA 4mHH0m01rKoJAPH9bfLbxtNkRL6SPCqzNgukED/JyecaMQoC+3o9wuXAZbx7T7LuX3UG PNfni7TJeBa8siZFR3rbfEXcegM+aNfL7ApRWDWRGDvqYD6lLs+revJx9U92hqF7hWdo wAN/iiP+KHHz/jiUk4ZgIRlACSjjDTsDpX8FtGNIeiCpBMyIH0SEhV+Skj/9FkwuQWbe /2yQ== X-Gm-Message-State: AOAM532cb5IRVtqRFQB/HqJq/sIrM0XveH5s6BBZPrKMOezOFtMBIQ1G rafmZJMh4fjMt9tXA1w5lypYBeBYMow= X-Google-Smtp-Source: ABdhPJxwnkls4lek3K2Bu6I6WtNTJS4RqTJ/dfpcTohJcwpNyB1skccdLulymzj/A83VL8khtl5YjK1oQEc= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a25:ac5a:: with SMTP id r26mr9406387ybd.336.1611353164151; Fri, 22 Jan 2021 14:06:04 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:51 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-2-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 01/10] mm: use add_page_to_lru_list() 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 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: There is add_page_to_lru_list(), and move_pages_to_lru() should reuse it, not duplicate it. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-2-yuzhao@google.com/ Signed-off-by: Yu Zhao Reviewed-by: Alex Shi Acked-by: Vlastimil Babka Reviewed-by: Miaohe Lin --- mm/vmscan.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 04509994aed4..19875660e8f8 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1823,7 +1823,6 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, int nr_pages, nr_moved = 0; LIST_HEAD(pages_to_free); struct page *page; - enum lru_list lru; while (!list_empty(list)) { page = lru_to_page(list); @@ -1868,11 +1867,8 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, * inhibits memcg migration). */ VM_BUG_ON_PAGE(!lruvec_holds_page_lru_lock(page, lruvec), page); - lru = page_lru(page); + add_page_to_lru_list(page, lruvec, page_lru(page)); nr_pages = thp_nr_pages(page); - - update_lru_size(lruvec, lru, page_zonenum(page), nr_pages); - list_add(&page->lru, &lruvec->lists[lru]); nr_moved += nr_pages; if (PageActive(page)) workingset_age_nonresident(lruvec, nr_pages); From patchwork Fri Jan 22 22:05:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040723 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.6 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 0EA63C433E0 for ; Fri, 22 Jan 2021 22:06:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8D78C23B06 for ; Fri, 22 Jan 2021 22:06:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D78C23B06 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 5A05E6B000C; Fri, 22 Jan 2021 17:06:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 530226B000D; Fri, 22 Jan 2021 17:06:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F4406B000E; Fri, 22 Jan 2021 17:06:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0057.hostedemail.com [216.40.44.57]) by kanga.kvack.org (Postfix) with ESMTP id 27F396B000C for ; Fri, 22 Jan 2021 17:06:07 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DC60280D388A for ; Fri, 22 Jan 2021 22:06:06 +0000 (UTC) X-FDA: 77734794732.30.baby00_310d8d02756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id A074D180192C2 for ; Fri, 22 Jan 2021 22:06:06 +0000 (UTC) X-HE-Tag: baby00_310d8d02756f X-Filterd-Recvd-Size: 5466 Received: from mail-qt1-f202.google.com (mail-qt1-f202.google.com [209.85.160.202]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:06 +0000 (UTC) Received: by mail-qt1-f202.google.com with SMTP id h16so4337267qta.12 for ; Fri, 22 Jan 2021 14:06:05 -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=zqJBSEFOCSzIlkUNnwRdzfLTBxKdVKLR5dZ8YTF2q6U=; b=rG/XTRwLXknzPDC4uYHVqOY/HbH5hHEQ0yFdGo+ZZKfsDhtzx12Cuti8WHf/zvmsyy sBFU7cHHAd7O08AQohRUGzPfke0djxwWn9N0NIcQVBArSupoca61FjSEFgn49UUmYsAY pM3nTXPYjd63HQ99os/k79RDZHB3rGbH5W4MIyWq4DwRGfq5c37hSp08YTbyv4CSvIrI RKRtA4nhcMtD87Q9Fy1bUo6VQ8ughjnUbMU6loLyrElRkDkWOogdp3MzlHDS4hbi+7hv v62UDbh3ZaMLytm0blgPvrZwhmTvTYhwR0bE4cK656rN6wcioXm+xenrXnfX2A2TTkB5 HnDA== 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=zqJBSEFOCSzIlkUNnwRdzfLTBxKdVKLR5dZ8YTF2q6U=; b=DUZ6lWmM6ACH00bqjhOpJEuiI4Q/yvlda2IYIThx0T9nDtgin7cIp7Sh98QWhgIKCK lWPEv+30sDinHTJDxSFQEpfCg3GwB2+Waw23GllbRjPsY3OBkQ7jqbqJNmqu1eVYndPH rh/WGMQ7uXtnIuh4D3fPUqPLAg1mEWLzGcKsS2mFjtV4o4pKB8fz7upJ8ctzriNkV3Xe EoeW2S84hbKdJEqCZz/MnXF2S4JwsmPgSnVOUdkuKII2OmEC8NcQCXZYZBcJ05iCpbZs XTvL/HKGOOkrA+2aGUNN6aXySZHRa+Tf7pwwH/rfWyUpvg7Ek/b8dJo/oLIP7Gh4/TCe 1+tQ== X-Gm-Message-State: AOAM532nMAaf7l8sEfnoc1fGrDVhHrzmMkL2a0E0B2m6OizAg9QZG5a9 So64EovHgGrKnSYr61gZza7X8Px8leU= X-Google-Smtp-Source: ABdhPJwlAztSJs7BRfLWDrzsSVMS5kBimqXyS88rYohA6fu8gn8Ysp1ivWG7MGrOqyqiWMi9AjdSlsdSKrU= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a0c:ac44:: with SMTP id m4mr6659932qvb.45.1611353165356; Fri, 22 Jan 2021 14:06:05 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:52 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-3-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 02/10] mm: shuffle lru list addition and deletion functions 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 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: These functions will call page_lru() in the following patches. Move them below page_lru() to avoid the forward declaration. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-3-yuzhao@google.com/ Signed-off-by: Yu Zhao Acked-by: Vlastimil Babka Reviewed-by: Miaohe Lin --- include/linux/mm_inline.h | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 8fc71e9d7bb0..2889741f450a 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -45,27 +45,6 @@ static __always_inline void update_lru_size(struct lruvec *lruvec, #endif } -static __always_inline void add_page_to_lru_list(struct page *page, - struct lruvec *lruvec, enum lru_list lru) -{ - update_lru_size(lruvec, lru, page_zonenum(page), thp_nr_pages(page)); - list_add(&page->lru, &lruvec->lists[lru]); -} - -static __always_inline void add_page_to_lru_list_tail(struct page *page, - struct lruvec *lruvec, enum lru_list lru) -{ - update_lru_size(lruvec, lru, page_zonenum(page), thp_nr_pages(page)); - list_add_tail(&page->lru, &lruvec->lists[lru]); -} - -static __always_inline void del_page_from_lru_list(struct page *page, - struct lruvec *lruvec, enum lru_list lru) -{ - list_del(&page->lru); - update_lru_size(lruvec, lru, page_zonenum(page), -thp_nr_pages(page)); -} - /** * page_lru_base_type - which LRU list type should a page be on? * @page: the page to test @@ -125,4 +104,25 @@ static __always_inline enum lru_list page_lru(struct page *page) } return lru; } + +static __always_inline void add_page_to_lru_list(struct page *page, + struct lruvec *lruvec, enum lru_list lru) +{ + update_lru_size(lruvec, lru, page_zonenum(page), thp_nr_pages(page)); + list_add(&page->lru, &lruvec->lists[lru]); +} + +static __always_inline void add_page_to_lru_list_tail(struct page *page, + struct lruvec *lruvec, enum lru_list lru) +{ + update_lru_size(lruvec, lru, page_zonenum(page), thp_nr_pages(page)); + list_add_tail(&page->lru, &lruvec->lists[lru]); +} + +static __always_inline void del_page_from_lru_list(struct page *page, + struct lruvec *lruvec, enum lru_list lru) +{ + list_del(&page->lru); + update_lru_size(lruvec, lru, page_zonenum(page), -thp_nr_pages(page)); +} #endif From patchwork Fri Jan 22 22:05:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040725 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.6 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 445E3C433E0 for ; Fri, 22 Jan 2021 22:06:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CFB1E23B16 for ; Fri, 22 Jan 2021 22:06:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFB1E23B16 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 6B0226B000D; Fri, 22 Jan 2021 17:06:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6613A6B000E; Fri, 22 Jan 2021 17:06:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52CF36B0010; Fri, 22 Jan 2021 17:06:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0238.hostedemail.com [216.40.44.238]) by kanga.kvack.org (Postfix) with ESMTP id 384386B000D for ; Fri, 22 Jan 2021 17:06:08 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 00B8318222A1F for ; Fri, 22 Jan 2021 22:06:07 +0000 (UTC) X-FDA: 77734794816.19.cast37_2a102752756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id CC9F614AFD0 for ; Fri, 22 Jan 2021 22:06:07 +0000 (UTC) X-HE-Tag: cast37_2a102752756f X-Filterd-Recvd-Size: 8252 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:07 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id s7so6890007ybj.0 for ; Fri, 22 Jan 2021 14:06:07 -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=6tYKFJlOjUi4v7dxUtU008EVEUsjebXj9aGlyhOOTRY=; b=Lin1fBDfs49ToqHhinKJo5WCabg8cHvmzRGU+MHB8noS3TO/7kdhKHSq4B21/HSvv7 AL3T4lUw2JOJCYvpE92NGm0M0I5R7+C+XMUcp2i9Ia3OcbPr58HmNRIw33WaeqX4l996 Z6nwLSRZoA4C2+vuIjXmlbPEmOMoHPu+6X8tKncG7cYSbBp+6RrJp7G7gbD9q0K4lrKi +KWa02wUceBS0I2sIrqe2K2isxVB3q+0P/pyp2lG3iu3BCAczy673wh46XDlhlp5QSdO f5iaCtkS1oPH3+Zy6OuYpmHfZcy7KY15IqaKYuRxg77zbBANht275o4xt6yws4Fic98w JP1w== 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=6tYKFJlOjUi4v7dxUtU008EVEUsjebXj9aGlyhOOTRY=; b=mLI4TuSWYnBXlBVAVGaS6i+M3BSEX8f3Af/0uMHQiDYokSn3RpU2M3CsT/0cSgXVen 4uONYNxSMoJOmxF+ZNDQRBqUeI6C4RU7YgdD60dllxbPDShTBBp1tA9oZkQFoRJ2AVJC cqzkH4RlkpvWHUD66It95EGw/Wenqu9SYaqByL8SSZ1u0Me/71cXr/8RqBhGafh/I9ip 8BM9SbJfvQ1/QmMFRVMNPwfwaswa4B/qesNbZUz/LXLRUKGvPiOuK9B672vO1JbZy3PM AVNGFzPABb8sX3mIQFUkIADZATinxMVDVZ2CyE6kN9BnBTaLyEYyx0r8r4wNEAg9UNt2 mbZQ== X-Gm-Message-State: AOAM532cXFnc8jGQBpfGntjf59CN6SQrWSEXWyhdhEqFf98fkAr9BM8k WFOUu26ygjIniWtXIRCy/Sq5CUVmBso= X-Google-Smtp-Source: ABdhPJz2EAXiGRuqsYtX77btAm5YE4nGxkhkS/RBacGhOf2nSumfuEHnFAm6QB5hWkYOUqSstiSFAt0a2R0= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a25:9b45:: with SMTP id u5mr9202755ybo.331.1611353166601; Fri, 22 Jan 2021 14:06:06 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:53 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-4-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 03/10] mm: don't pass "enum lru_list" to lru list addition functions 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 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: The "enum lru_list" parameter to add_page_to_lru_list() and add_page_to_lru_list_tail() is redundant in the sense that it can be extracted from the "struct page" parameter by page_lru(). A caveat is that we need to make sure PageActive() or PageUnevictable() is correctly set or cleared before calling these two functions. And they are indeed. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-4-yuzhao@google.com/ Signed-off-by: Yu Zhao --- include/linux/mm_inline.h | 8 ++++++-- mm/swap.c | 15 +++++++-------- mm/vmscan.c | 6 ++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 2889741f450a..130ba3201d3f 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -106,15 +106,19 @@ static __always_inline enum lru_list page_lru(struct page *page) } static __always_inline void add_page_to_lru_list(struct page *page, - struct lruvec *lruvec, enum lru_list lru) + struct lruvec *lruvec) { + enum lru_list lru = page_lru(page); + update_lru_size(lruvec, lru, page_zonenum(page), thp_nr_pages(page)); list_add(&page->lru, &lruvec->lists[lru]); } static __always_inline void add_page_to_lru_list_tail(struct page *page, - struct lruvec *lruvec, enum lru_list lru) + struct lruvec *lruvec) { + enum lru_list lru = page_lru(page); + update_lru_size(lruvec, lru, page_zonenum(page), thp_nr_pages(page)); list_add_tail(&page->lru, &lruvec->lists[lru]); } diff --git a/mm/swap.c b/mm/swap.c index 490553f3f9ef..4b058ef37add 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -231,7 +231,7 @@ static void pagevec_move_tail_fn(struct page *page, struct lruvec *lruvec) if (!PageUnevictable(page)) { del_page_from_lru_list(page, lruvec, page_lru(page)); ClearPageActive(page); - add_page_to_lru_list_tail(page, lruvec, page_lru(page)); + add_page_to_lru_list_tail(page, lruvec); __count_vm_events(PGROTATED, thp_nr_pages(page)); } } @@ -313,8 +313,7 @@ static void __activate_page(struct page *page, struct lruvec *lruvec) del_page_from_lru_list(page, lruvec, lru); 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); __count_vm_events(PGACTIVATE, nr_pages); @@ -543,14 +542,14 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec) * It can make readahead confusing. But race window * is _really_ small and it's non-critical problem. */ - add_page_to_lru_list(page, lruvec, lru); + add_page_to_lru_list(page, lruvec); SetPageReclaim(page); } else { /* * The page's writeback ends up during pagevec * We moves tha page into tail of inactive. */ - add_page_to_lru_list_tail(page, lruvec, lru); + add_page_to_lru_list_tail(page, lruvec); __count_vm_events(PGROTATED, nr_pages); } @@ -570,7 +569,7 @@ static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec) del_page_from_lru_list(page, lruvec, lru + LRU_ACTIVE); ClearPageActive(page); ClearPageReferenced(page); - add_page_to_lru_list(page, lruvec, lru); + add_page_to_lru_list(page, lruvec); __count_vm_events(PGDEACTIVATE, nr_pages); __count_memcg_events(lruvec_memcg(lruvec), PGDEACTIVATE, @@ -595,7 +594,7 @@ static void lru_lazyfree_fn(struct page *page, struct lruvec *lruvec) * anonymous pages */ ClearPageSwapBacked(page); - add_page_to_lru_list(page, lruvec, LRU_INACTIVE_FILE); + add_page_to_lru_list(page, lruvec); __count_vm_events(PGLAZYFREE, nr_pages); __count_memcg_events(lruvec_memcg(lruvec), PGLAZYFREE, @@ -1005,7 +1004,7 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec) __count_vm_events(UNEVICTABLE_PGCULLED, nr_pages); } - add_page_to_lru_list(page, lruvec, lru); + add_page_to_lru_list(page, lruvec); trace_mm_lru_insertion(page, lru); } diff --git a/mm/vmscan.c b/mm/vmscan.c index 19875660e8f8..09e4f97488c9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1867,7 +1867,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, * inhibits memcg migration). */ VM_BUG_ON_PAGE(!lruvec_holds_page_lru_lock(page, lruvec), page); - add_page_to_lru_list(page, lruvec, page_lru(page)); + add_page_to_lru_list(page, lruvec); nr_pages = thp_nr_pages(page); nr_moved += nr_pages; if (PageActive(page)) @@ -4282,12 +4282,10 @@ void check_move_unevictable_pages(struct pagevec *pvec) lruvec = relock_page_lruvec_irq(page, lruvec); if (page_evictable(page) && PageUnevictable(page)) { - enum lru_list lru = page_lru_base_type(page); - VM_BUG_ON_PAGE(PageActive(page), page); ClearPageUnevictable(page); del_page_from_lru_list(page, lruvec, LRU_UNEVICTABLE); - add_page_to_lru_list(page, lruvec, lru); + add_page_to_lru_list(page, lruvec); pgrescued += nr_pages; } SetPageLRU(page); From patchwork Fri Jan 22 22:05:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040727 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.6 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 B5E6DC433DB for ; Fri, 22 Jan 2021 22:06:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4BF1723B1A for ; Fri, 22 Jan 2021 22:06:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BF1723B1A 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 10ED26B000E; Fri, 22 Jan 2021 17:06:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 047F26B0012; Fri, 22 Jan 2021 17:06:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA0816B0022; Fri, 22 Jan 2021 17:06:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id CF77D6B000E for ; Fri, 22 Jan 2021 17:06:09 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8C48280D388A for ; Fri, 22 Jan 2021 22:06:09 +0000 (UTC) X-FDA: 77734794858.01.bomb11_040ba7a2756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 725E2100D2CE6 for ; Fri, 22 Jan 2021 22:06:09 +0000 (UTC) X-HE-Tag: bomb11_040ba7a2756f X-Filterd-Recvd-Size: 5332 Received: from mail-qt1-f202.google.com (mail-qt1-f202.google.com [209.85.160.202]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:08 +0000 (UTC) Received: by mail-qt1-f202.google.com with SMTP id r18so889609qta.19 for ; Fri, 22 Jan 2021 14:06:08 -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=Cnppx+CVBWio8kiSnapIqmyvLMG7ttWaX8+dG0VcN8Y=; b=npAvqpOHZYHenjgtdugR1VSi14cpzy+ZIkNex0ST5ae5o3EmcZKLBncTqAn37cV9Ha 7suIKcduY/L+fjLpB6nnt8XblQGuXPWrFssRY2sgQ2xaPX7NFiI5Vn9WRODqIdOd4YBr zKdwgpBX0f2M2PAg8q9FwnZUpbcyfeyXx16cvqEjDcbRp9IMPR09K8CJZgk4B5MH+zBD HV6OqJTVBhI9mfxd9igc9A5veHUAQ4X2rZLqI/8+JWTSCCjEQyOmbSO7xGUyRi6YCqHt uWd+XgAKkb2lbf2PflaT0Rn/g0y2edCLy5BGaN/CHAQBxRCilsuaqZuXLF2Za4UXg6XA 5ANw== 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=Cnppx+CVBWio8kiSnapIqmyvLMG7ttWaX8+dG0VcN8Y=; b=sFvSV9E8MktQ19qXVFo1FMT+EGxD8hRR9nAZjOZ+RjKDkO7wxz6M27pHvuNRcaVBVU cuUjTAnfKGBLWJs5kFoQs1vZ2Q5ImPITM8TRv3I3e/AkS/sdyKcnqHa+FhFoSf08YieB ZqkEu0UHITL1r96tqnRga0bFRVn+WNhNaorsn/O31+n833GL4omxXpBpW1W7QzvyS5od V9eF/cQnlYxJRLNN4oYX8NI1o/os2hPdpoiJ3I6DUob/xAYc4fyBF0mYl0ha3C+nwkWi 6SjTG7Fu8C2mKOk9kFfFST2EGmlB0ulBHDIYUqfvAse+SGYMpU4sdSatceXlN9kDGWQg ZL7g== X-Gm-Message-State: AOAM531DkbdPqdw8Ry8IdiBbtGUiPwfd4nzVQtxJkJNLIzTBrTL9v05G ATeccv2TDgYX4CY8g6s7qal1VZ7yBq0= X-Google-Smtp-Source: ABdhPJzH2ptmbGlJJ4A0Eip3F7crD9fwrpLPZvwjmm+gGrcj39Bh07beIr4B9mEPXyRX5H/9ms4FexJiycw= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:ad4:4108:: with SMTP id i8mr6324900qvp.49.1611353167796; Fri, 22 Jan 2021 14:06:07 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:54 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-5-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 04/10] mm: don't pass "enum lru_list" to trace_mm_lru_insertion() 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 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: The parameter is redundant in the sense that it can be extracted from the "struct page" parameter by page_lru() correctly. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-5-yuzhao@google.com/ Signed-off-by: Yu Zhao Reviewed-by: Alex Shi --- include/trace/events/pagemap.h | 11 ++++------- mm/swap.c | 5 +---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/trace/events/pagemap.h b/include/trace/events/pagemap.h index 8fd1babae761..e1735fe7c76a 100644 --- a/include/trace/events/pagemap.h +++ b/include/trace/events/pagemap.h @@ -27,24 +27,21 @@ TRACE_EVENT(mm_lru_insertion, - TP_PROTO( - struct page *page, - int lru - ), + TP_PROTO(struct page *page), - TP_ARGS(page, lru), + TP_ARGS(page), TP_STRUCT__entry( __field(struct page *, page ) __field(unsigned long, pfn ) - __field(int, lru ) + __field(enum lru_list, lru ) __field(unsigned long, flags ) ), TP_fast_assign( __entry->page = page; __entry->pfn = page_to_pfn(page); - __entry->lru = lru; + __entry->lru = page_lru(page); __entry->flags = trace_pagemap_flags(page); ), diff --git a/mm/swap.c b/mm/swap.c index 4b058ef37add..56682c002db7 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -957,7 +957,6 @@ EXPORT_SYMBOL(__pagevec_release); static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec) { - enum lru_list lru; int was_unevictable = TestClearPageUnevictable(page); int nr_pages = thp_nr_pages(page); @@ -993,11 +992,9 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec) smp_mb__after_atomic(); if (page_evictable(page)) { - lru = page_lru(page); if (was_unevictable) __count_vm_events(UNEVICTABLE_PGRESCUED, nr_pages); } else { - lru = LRU_UNEVICTABLE; ClearPageActive(page); SetPageUnevictable(page); if (!was_unevictable) @@ -1005,7 +1002,7 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec) } add_page_to_lru_list(page, lruvec); - trace_mm_lru_insertion(page, lru); + trace_mm_lru_insertion(page); } /* From patchwork Fri Jan 22 22:05:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040729 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.6 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 153BAC433E6 for ; Fri, 22 Jan 2021 22:06:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 95A5C23B06 for ; Fri, 22 Jan 2021 22:06:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95A5C23B06 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 E2AA76B0022; Fri, 22 Jan 2021 17:06:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DDFD06B0023; Fri, 22 Jan 2021 17:06:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF0506B0024; Fri, 22 Jan 2021 17:06:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BA26E6B0022 for ; Fri, 22 Jan 2021 17:06:10 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8634C363C for ; Fri, 22 Jan 2021 22:06:10 +0000 (UTC) X-FDA: 77734794900.26.man36_4f16ec22756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 5F4B8180CC5D0 for ; Fri, 22 Jan 2021 22:06:10 +0000 (UTC) X-HE-Tag: man36_4f16ec22756f X-Filterd-Recvd-Size: 9757 Received: from mail-qt1-f202.google.com (mail-qt1-f202.google.com [209.85.160.202]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:09 +0000 (UTC) Received: by mail-qt1-f202.google.com with SMTP id h16so4337346qta.12 for ; Fri, 22 Jan 2021 14:06:09 -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=dY2ZUp0PF6rLon2iFmQEtt29TVjYa1d8HYIO3og6VGs=; b=XSKdRG2I+FkXq7NpjZTTTTrJiyL4WMljgJGfpCpMX4dS+I+uUBI4P213WwG7nHFXkk OqKzFCKwT90hKLnRZ5tj1XMWqOVag8ojh7gjXo4mZBNxRRFJiK9Z8p2fZOJIjm0dCCag FeR87Dzi8czafYpSk1Ph/iRWZgmCGDSZy4d7LWqOP7wD2GSgCmJpvrrcX7ttXeCkKMs/ 6psZtcO5t36E75MEiffG+kh+9CXlSuhcorY+03WMRchIZaitrvcKuh5LDlAkIMPmwSMh Iw/JyMUb0D2OV1wp0BM+RNphNNYbKleBQzrG5mlR9AL2/Y4NhBXA6bgP9IjmggdKjW3A GVHw== 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=dY2ZUp0PF6rLon2iFmQEtt29TVjYa1d8HYIO3og6VGs=; b=TElBR13dNS9A74ZAUEZQ8NQb0HUoOeq00WZx8MCRsFm+fhFbs4AQdDO44VA/SGJDY6 Hwy+a3bkx/HRcg+AQfzufUppDtJRMjRRnA8nLd/BbxR7vB/4pVVPXN/lKYNBj00i+2xI sR8G5Ee4BKxEo17lHlvAMwXSUgPWBNd40uxdwrwE+ZYlEoOWodzgBMGxPPSAHPC1m+KI t0HcUFr+OKHFhpNDBnkBqW3zwgLuE/KNQBHJzg+mPmf2XKddt8Ytg2+L8aVW8D1yEldQ UKHZFYL4Uk+gXFcd/s5oPVpDlxgtIur5RLX/2/RRY1VmlLIczJDIRwLXHwu11RFW9eK2 PvYw== X-Gm-Message-State: AOAM532ZKcPQYM1Vif6MafT7Z82k8HvS1UkR+w0ERuA5kumv3aSujFyN ZXwaFHO2z99B0E+Te1LIgcgMwUBSm8U= X-Google-Smtp-Source: ABdhPJxFPaXdnBEP2moUANWUz9QxU291FJpi9b9+T2aZQPfn6M4adT85YHD5opPYDdFiI93hCOOhDWzlpng= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a0c:8c87:: with SMTP id p7mr796493qvb.46.1611353169058; Fri, 22 Jan 2021 14:06:09 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:55 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-6-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 05/10] mm: don't pass "enum lru_list" to del_page_from_lru_list() 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 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: The parameter is redundant in the sense that it can be potentially extracted from the "struct page" parameter by page_lru(). We need to make sure that existing PageActive() or PageUnevictable() remains until the function returns. A few places don't conform, and simple reordering fixes them. This patch may have left page_off_lru() seemingly odd, and we'll take care of it in the next patch. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-6-yuzhao@google.com/ Signed-off-by: Yu Zhao --- include/linux/mm_inline.h | 5 +++-- mm/compaction.c | 2 +- mm/mlock.c | 3 +-- mm/swap.c | 26 ++++++++++---------------- mm/vmscan.c | 4 ++-- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 130ba3201d3f..ffacc6273678 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -124,9 +124,10 @@ static __always_inline void add_page_to_lru_list_tail(struct page *page, } static __always_inline void del_page_from_lru_list(struct page *page, - struct lruvec *lruvec, enum lru_list lru) + struct lruvec *lruvec) { list_del(&page->lru); - update_lru_size(lruvec, lru, page_zonenum(page), -thp_nr_pages(page)); + update_lru_size(lruvec, page_lru(page), page_zonenum(page), + -thp_nr_pages(page)); } #endif diff --git a/mm/compaction.c b/mm/compaction.c index 6e21db7f51b3..71fab3f5938c 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1030,7 +1030,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, low_pfn += compound_nr(page) - 1; /* Successfully isolated */ - del_page_from_lru_list(page, lruvec, page_lru(page)); + del_page_from_lru_list(page, lruvec); mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + page_is_file_lru(page), thp_nr_pages(page)); diff --git a/mm/mlock.c b/mm/mlock.c index 55b3b3672977..73960bb3464d 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -278,8 +278,7 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone) */ if (TestClearPageLRU(page)) { lruvec = relock_page_lruvec_irq(page, lruvec); - del_page_from_lru_list(page, lruvec, - page_lru(page)); + del_page_from_lru_list(page, lruvec); continue; } else __munlock_isolation_failed(page); diff --git a/mm/swap.c b/mm/swap.c index 56682c002db7..94532799ed82 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -85,7 +85,8 @@ static void __page_cache_release(struct page *page) lruvec = lock_page_lruvec_irqsave(page, &flags); VM_BUG_ON_PAGE(!PageLRU(page), page); __ClearPageLRU(page); - del_page_from_lru_list(page, lruvec, page_off_lru(page)); + del_page_from_lru_list(page, lruvec); + page_off_lru(page); unlock_page_lruvec_irqrestore(lruvec, flags); } __ClearPageWaiters(page); @@ -229,7 +230,7 @@ static void pagevec_lru_move_fn(struct pagevec *pvec, static void pagevec_move_tail_fn(struct page *page, struct lruvec *lruvec) { if (!PageUnevictable(page)) { - del_page_from_lru_list(page, lruvec, page_lru(page)); + del_page_from_lru_list(page, lruvec); ClearPageActive(page); add_page_to_lru_list_tail(page, lruvec); __count_vm_events(PGROTATED, thp_nr_pages(page)); @@ -308,10 +309,9 @@ void lru_note_cost_page(struct page *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); add_page_to_lru_list(page, lruvec); trace_mm_lru_activate(page); @@ -518,8 +518,7 @@ void lru_cache_add_inactive_or_unevictable(struct page *page, */ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec) { - int lru; - bool active; + bool active = PageActive(page); int nr_pages = thp_nr_pages(page); if (PageUnevictable(page)) @@ -529,10 +528,7 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec) if (page_mapped(page)) return; - active = PageActive(page); - lru = page_lru_base_type(page); - - del_page_from_lru_list(page, lruvec, lru + active); + del_page_from_lru_list(page, lruvec); ClearPageActive(page); ClearPageReferenced(page); @@ -563,10 +559,9 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec) static void lru_deactivate_fn(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 + LRU_ACTIVE); + del_page_from_lru_list(page, lruvec); ClearPageActive(page); ClearPageReferenced(page); add_page_to_lru_list(page, lruvec); @@ -581,11 +576,9 @@ static void lru_lazyfree_fn(struct page *page, struct lruvec *lruvec) { if (PageAnon(page) && PageSwapBacked(page) && !PageSwapCache(page) && !PageUnevictable(page)) { - bool active = PageActive(page); int nr_pages = thp_nr_pages(page); - del_page_from_lru_list(page, lruvec, - LRU_INACTIVE_ANON + active); + del_page_from_lru_list(page, lruvec); ClearPageActive(page); ClearPageReferenced(page); /* @@ -919,7 +912,8 @@ void release_pages(struct page **pages, int nr) VM_BUG_ON_PAGE(!PageLRU(page), page); __ClearPageLRU(page); - del_page_from_lru_list(page, lruvec, page_off_lru(page)); + del_page_from_lru_list(page, lruvec); + page_off_lru(page); } __ClearPageWaiters(page); diff --git a/mm/vmscan.c b/mm/vmscan.c index 09e4f97488c9..7c65d47e6612 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1766,7 +1766,7 @@ int isolate_lru_page(struct page *page) get_page(page); lruvec = lock_page_lruvec_irq(page); - del_page_from_lru_list(page, lruvec, page_lru(page)); + del_page_from_lru_list(page, lruvec); unlock_page_lruvec_irq(lruvec); ret = 0; } @@ -4283,8 +4283,8 @@ void check_move_unevictable_pages(struct pagevec *pvec) lruvec = relock_page_lruvec_irq(page, lruvec); if (page_evictable(page) && PageUnevictable(page)) { VM_BUG_ON_PAGE(PageActive(page), page); + del_page_from_lru_list(page, lruvec); ClearPageUnevictable(page); - del_page_from_lru_list(page, lruvec, LRU_UNEVICTABLE); add_page_to_lru_list(page, lruvec); pgrescued += nr_pages; } From patchwork Fri Jan 22 22:05:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040731 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.6 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 3D872C433DB for ; Fri, 22 Jan 2021 22:06:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B7FE223B1B for ; Fri, 22 Jan 2021 22:06:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7FE223B1B 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 750776B0023; Fri, 22 Jan 2021 17:06:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6FD636B0024; Fri, 22 Jan 2021 17:06:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 578746B0025; Fri, 22 Jan 2021 17:06:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id 356BC6B0023 for ; Fri, 22 Jan 2021 17:06:12 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E9C8182D6B48 for ; Fri, 22 Jan 2021 22:06:11 +0000 (UTC) X-FDA: 77734794942.17.flesh18_13142752756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id CAE18181CCC92 for ; Fri, 22 Jan 2021 22:06:11 +0000 (UTC) X-HE-Tag: flesh18_13142752756f X-Filterd-Recvd-Size: 6373 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:11 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id b62so6898231ybg.1 for ; Fri, 22 Jan 2021 14:06:11 -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=PuLjvynrg4RueR9MnPtl/IKEUZzMuvZcczIQVkHLPxA=; b=is0zDnNnmJbohTyX0ICyl2GWebWoGZO3LYZYq5StpLjdztxZxQ1x6D4pDVi2482Wcv PFiQPq9Z2rZsA1VViLZtfi5aqmmNjb8NfcWwbdbfPOzR6r3ufyMTfhi//kRU8PpSgReq D8YOCZyVonQdyZjCBXQOHqkt4Hfb2a6uj8o/M49WOfP68LB9wKtRqZU4hmV/GBAoiJY2 anDaAB3i+hlhzjqJ1wqYSVewzAfw9Z6/KOBuxmDLh8AdH9EIVPFfDPA1s5N1k/Ibw6Lj wnF5TB35lr9GtfGP3xAPhXb4UMlp9t+ZyEEf95Lgyon4Um8ohy1XJjFFRUSgR2IWRjeu Z9dA== 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=PuLjvynrg4RueR9MnPtl/IKEUZzMuvZcczIQVkHLPxA=; b=JKmKBKqwE2PcAoIxnskpIVcVSUcXcpKThNIxGkqPsfQ04y2aE8+FHuUDcshdestpez b0BPrIFNeLY7sIPx6rcOsNuw8fvDbFTd7dMu1Ym1IK2W8uPVLAGPQSUUbAl/LJ6iq7JE ecH76b6UTugD66DOGryf69iQm2OO/W8OdVhH6m98nTzR2lM9ci4xgoqKysac3n6FMD0K EmGvtoQplNcYQ1aoANU2NfDdgvRE+3hCJQ9wJ3Fwu3zT0FaMGH+4AvRqxZcTbyJyR5lU f18JtQg0aQEyXVkRaJ89ta9WapeB286Kt/LeRgGqsus2vtBU21Gnt4rQAULvJ0cUUYmJ 3CyQ== X-Gm-Message-State: AOAM530U4ZzGFGqLKTWyYaD9kqgKpgeVmKM+z0yj3C3wvltQmYp23qPs f87/G5WISlRNcdaYBny50NtGVVB4K6c= X-Google-Smtp-Source: ABdhPJyRTcSRQhsSHaqqODslMrw0qd1Ys4U9WBeBKQcEiersSME0lIFIEZYEZdLFapETlRej2mLSzFfviX0= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a25:4296:: with SMTP id p144mr9927779yba.428.1611353170659; Fri, 22 Jan 2021 14:06:10 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:56 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-7-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 06/10] mm: add __clear_page_lru_flags() to replace page_off_lru() 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 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: Similar to page_off_lru(), the new function does non-atomic clearing of PageLRU() in addition to PageActive() and PageUnevictable(), on a page that has no references left. If PageActive() and PageUnevictable() are both set, refuse to clear either and leave them to bad_page(). This is a behavior change that is meant to help debug. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-7-yuzhao@google.com/ Signed-off-by: Yu Zhao --- include/linux/mm_inline.h | 28 ++++++++++------------------ mm/swap.c | 6 ++---- mm/vmscan.c | 3 +-- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index ffacc6273678..ef3fd79222e5 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -61,27 +61,19 @@ static inline enum lru_list page_lru_base_type(struct page *page) } /** - * page_off_lru - which LRU list was page on? clearing its lru flags. - * @page: the page to test - * - * Returns the LRU list a page was on, as an index into the array of LRU - * lists; and clears its Unevictable or Active flags, ready for freeing. + * __clear_page_lru_flags - clear page lru flags before releasing a page + * @page: the page that was on lru and now has a zero reference */ -static __always_inline enum lru_list page_off_lru(struct page *page) +static __always_inline void __clear_page_lru_flags(struct page *page) { - enum lru_list lru; + __ClearPageLRU(page); - if (PageUnevictable(page)) { - __ClearPageUnevictable(page); - lru = LRU_UNEVICTABLE; - } else { - lru = page_lru_base_type(page); - if (PageActive(page)) { - __ClearPageActive(page); - lru += LRU_ACTIVE; - } - } - return lru; + /* this shouldn't happen, so leave the flags to bad_page() */ + if (PageActive(page) && PageUnevictable(page)) + return; + + __ClearPageActive(page); + __ClearPageUnevictable(page); } /** diff --git a/mm/swap.c b/mm/swap.c index 94532799ed82..38900d672051 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -84,9 +84,8 @@ static void __page_cache_release(struct page *page) lruvec = lock_page_lruvec_irqsave(page, &flags); VM_BUG_ON_PAGE(!PageLRU(page), page); - __ClearPageLRU(page); del_page_from_lru_list(page, lruvec); - page_off_lru(page); + __clear_page_lru_flags(page); unlock_page_lruvec_irqrestore(lruvec, flags); } __ClearPageWaiters(page); @@ -911,9 +910,8 @@ void release_pages(struct page **pages, int nr) lock_batch = 0; VM_BUG_ON_PAGE(!PageLRU(page), page); - __ClearPageLRU(page); del_page_from_lru_list(page, lruvec); - page_off_lru(page); + __clear_page_lru_flags(page); } __ClearPageWaiters(page); diff --git a/mm/vmscan.c b/mm/vmscan.c index 7c65d47e6612..452dd3818aa3 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1849,8 +1849,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, SetPageLRU(page); if (unlikely(put_page_testzero(page))) { - __ClearPageLRU(page); - __ClearPageActive(page); + __clear_page_lru_flags(page); if (unlikely(PageCompound(page))) { spin_unlock_irq(&lruvec->lru_lock); From patchwork Fri Jan 22 22:05:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040733 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.6 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 1D49DC433E0 for ; Fri, 22 Jan 2021 22:06:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B85EB23B06 for ; Fri, 22 Jan 2021 22:06:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B85EB23B06 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 E30216B0025; Fri, 22 Jan 2021 17:06:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D16D76B0026; Fri, 22 Jan 2021 17:06:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2C8B6B0027; Fri, 22 Jan 2021 17:06:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id AB8A36B0025 for ; Fri, 22 Jan 2021 17:06:13 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 78C4D3ABF for ; Fri, 22 Jan 2021 22:06:13 +0000 (UTC) X-FDA: 77734795026.21.cast95_5e08e392756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 498E1181EE429 for ; Fri, 22 Jan 2021 22:06:13 +0000 (UTC) X-HE-Tag: cast95_5e08e392756f X-Filterd-Recvd-Size: 5362 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:12 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id y1so6887428ybe.11 for ; Fri, 22 Jan 2021 14:06:12 -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=fAuiFEZ8FCk1cyn9mPE9ipM3xtIpXox+XMx0+fOv6K0=; b=Tj3WeTBV23IF4aMWa4+0shsXAgeLKrQYNXoF2rnMDFzObm0V3stFevul6MDDuv0Vjy Uveak3xihcbz4I0qEFCBUG9x+WRhUSOYvOYJddiGvbmvnYZVRCJEwlN4LSfIwJtsMeMj WYTw2yQ36r6EHIJVvUKyK1o1e8rBlvI8xIi1PdDD61BzAbjGfvrK4hTjit/ZUPj8hBAx AeWHuF3krzcIQD5JGpwgGxNrwXjLtM7re+126AiQbRwzc7qMNaw4EdvwjTXfXUgnJ2e6 NHP6clrqZtkZBATC9zU9jT/XBZqoUQr7+GJXkqYkGh5vo7ahJe1CSzFdfRGGK+he8pus vqFg== 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=fAuiFEZ8FCk1cyn9mPE9ipM3xtIpXox+XMx0+fOv6K0=; b=Wc8zxriVrwXkdKuPVEzZgg1q/NgbnfxXvZfhP/7sZjNfXkFH+MJyQUBwiKs1yOPnv2 M4sy0P5OMrNM8RRAGoGDtnLQxeyQKi+Xnwl1IdgppbJoopO7fGjMxTX++uJ1K37GGvRy R1A5nDj3PgkViX90BuiqhsUMG8ck715HyxUIUKLnrefJ94GrlsHlACz6avTd/uP56OB+ MpZWW03nAiaKteK1uM3ReCBGALRb7FVPfvzUtO4BVdocB/Z82NJ00hutusaLV4iOxqeI lqegTeWcd1NUrv6wdRI4FQeVKo5SS62zVlu3/EqFbU0v/bFtynJFFBlSUNlpMnlfgRga 8hgA== X-Gm-Message-State: AOAM532OkJD45xrDzyJm0yqPGfKGVCo3devOZyqP+4WELALaQL2yyQep +pp7H6z5mmNb1Pl8uaY/DPC2q1Ize20= X-Google-Smtp-Source: ABdhPJzNQu1VwToQATIslnVn1F+DC21pIfxNwXyzzKXRWXw7PukDCkvFCwvjuDiotly+Vtus46FsaQy6rPw= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a25:2505:: with SMTP id l5mr9365754ybl.292.1611353172069; Fri, 22 Jan 2021 14:06:12 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:57 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-8-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 07/10] mm: VM_BUG_ON lru page flags 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 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: Move scattered VM_BUG_ONs to two essential places that cover all lru list additions and deletions. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-8-yuzhao@google.com/ Signed-off-by: Yu Zhao --- include/linux/mm_inline.h | 4 ++++ mm/swap.c | 2 -- mm/vmscan.c | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index ef3fd79222e5..6d907a4dd6ad 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -66,6 +66,8 @@ static inline enum lru_list page_lru_base_type(struct page *page) */ static __always_inline void __clear_page_lru_flags(struct page *page) { + VM_BUG_ON_PAGE(!PageLRU(page), page); + __ClearPageLRU(page); /* this shouldn't happen, so leave the flags to bad_page() */ @@ -87,6 +89,8 @@ static __always_inline enum lru_list page_lru(struct page *page) { enum lru_list lru; + VM_BUG_ON_PAGE(PageActive(page) && PageUnevictable(page), page); + if (PageUnevictable(page)) lru = LRU_UNEVICTABLE; else { diff --git a/mm/swap.c b/mm/swap.c index 38900d672051..31b844d4ed94 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -83,7 +83,6 @@ static void __page_cache_release(struct page *page) unsigned long flags; lruvec = lock_page_lruvec_irqsave(page, &flags); - VM_BUG_ON_PAGE(!PageLRU(page), page); del_page_from_lru_list(page, lruvec); __clear_page_lru_flags(page); unlock_page_lruvec_irqrestore(lruvec, flags); @@ -909,7 +908,6 @@ void release_pages(struct page **pages, int nr) if (prev_lruvec != lruvec) lock_batch = 0; - VM_BUG_ON_PAGE(!PageLRU(page), page); del_page_from_lru_list(page, lruvec); __clear_page_lru_flags(page); } diff --git a/mm/vmscan.c b/mm/vmscan.c index 452dd3818aa3..348a90096550 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4281,7 +4281,6 @@ void check_move_unevictable_pages(struct pagevec *pvec) lruvec = relock_page_lruvec_irq(page, lruvec); if (page_evictable(page) && PageUnevictable(page)) { - VM_BUG_ON_PAGE(PageActive(page), page); del_page_from_lru_list(page, lruvec); ClearPageUnevictable(page); add_page_to_lru_list(page, lruvec); From patchwork Fri Jan 22 22:05:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040735 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.6 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 ECA6BC433E6 for ; Fri, 22 Jan 2021 22:06:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7D74323B06 for ; Fri, 22 Jan 2021 22:06:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D74323B06 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 3CC908D0001; Fri, 22 Jan 2021 17:06:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 37CC46B0027; Fri, 22 Jan 2021 17:06:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CE478D0001; Fri, 22 Jan 2021 17:06:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id F0BDE6B0026 for ; Fri, 22 Jan 2021 17:06:14 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BFC8282D9A69 for ; Fri, 22 Jan 2021 22:06:14 +0000 (UTC) X-FDA: 77734795068.03.lock17_440bbe42756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 9D85728A4E8 for ; Fri, 22 Jan 2021 22:06:14 +0000 (UTC) X-HE-Tag: lock17_440bbe42756f X-Filterd-Recvd-Size: 4771 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:14 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id w30so788175ybi.7 for ; Fri, 22 Jan 2021 14:06:13 -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=CLgXtoSMSf4chkEdW8yrd9bZvEDFHVek70YcRsgvLdo=; b=n21Qu+vhD3FPQnNErkSfyB1JJsQj8dItdHyxzI4vIlKcnF69dBaAYDhS5EVTSWeTET lAFQAhNAm9xzKpF31PCWyVotC/FoEYwZEvKIfZB6X+cCVucd53PWMQ0+6RXC+2zHfl6O XM5vBvdJa/29P+ox0xdEyex8bfXnupKtZDsU5lzohHPAluJPt8nVS97YAgV4oSQXBE7a 6P0cM21iJv4Mqj8xTw1RKaQHaupNxxdnVTmIYsHhVtHj8f6Y97B2TTR4dPsyVqUVZXII y0E0ubLraQ/d/r2J/Lr5YsD2dTZKtpoBQGWVcAebiuVnFixbtqMqy91djMJEYKcJz6XU 5nMQ== 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=CLgXtoSMSf4chkEdW8yrd9bZvEDFHVek70YcRsgvLdo=; b=FIeltdhyq3Ey+TBau+pUltUBRnSqQsXsuAf+iU/R25vyMk5EFkVGUxawGHQ76CwKNF DbV/kZAcNWrwelI8tFWp5XLZd5ZSy57GylCuhcwmoPvZCh62RAXLg/gtwy11v+vw4T0d AlSE+lHfO7CD8Jr7763HsVfjzZ/Pg8OuFQajxlHbHVO4Cdrsyj70qk53puNu1gQsvNUA fwe5QMF4CII8z1ovBGh/GwIaxQduCDqLPuoMGZPHwh0voZrypCEYCVE+exolEfrt2fLA 7kreIehpfSM/6vRK7EFGUmeEB5ksUfXl52WX3An/5WHcGQpvJ3B6qTdX4eeEaaCDkw5w 5uqA== X-Gm-Message-State: AOAM533lvyjOlSiXkQloc4oUSQArXCtpjrzm49OFhf+DPWsokCc/34oU 8KO9B9v7RrI5qEo8bbKorjU+UHxKw3o= X-Google-Smtp-Source: ABdhPJzIdc5hTMSR1DaMMMCo4TFYoBE0en2JSCPQGQzA1Er5XzYdpjzSDq/j5NqC0FnAyeiIi+/Ammgzqgw= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a25:a86:: with SMTP id 128mr8664734ybk.370.1611353173347; Fri, 22 Jan 2021 14:06:13 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:58 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-9-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 08/10] mm: fold page_lru_base_type() into its sole caller 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 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: We've removed all other references to this function. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-9-yuzhao@google.com/ Signed-off-by: Yu Zhao Reviewed-by: Alex Shi --- include/linux/mm_inline.h | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 6d907a4dd6ad..7183c7a03f09 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -45,21 +45,6 @@ static __always_inline void update_lru_size(struct lruvec *lruvec, #endif } -/** - * page_lru_base_type - which LRU list type should a page be on? - * @page: the page to test - * - * Used for LRU list index arithmetic. - * - * Returns the base LRU type - file or anon - @page should be on. - */ -static inline enum lru_list page_lru_base_type(struct page *page) -{ - if (page_is_file_lru(page)) - return LRU_INACTIVE_FILE; - return LRU_INACTIVE_ANON; -} - /** * __clear_page_lru_flags - clear page lru flags before releasing a page * @page: the page that was on lru and now has a zero reference @@ -92,12 +77,12 @@ static __always_inline enum lru_list page_lru(struct page *page) VM_BUG_ON_PAGE(PageActive(page) && PageUnevictable(page), page); if (PageUnevictable(page)) - lru = LRU_UNEVICTABLE; - else { - lru = page_lru_base_type(page); - if (PageActive(page)) - lru += LRU_ACTIVE; - } + return LRU_UNEVICTABLE; + + lru = page_is_file_lru(page) ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON; + if (PageActive(page)) + lru += LRU_ACTIVE; + return lru; } From patchwork Fri Jan 22 22:05:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040737 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=-13.8 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, UNWANTED_LANGUAGE_BODY,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 EEBA7C433DB for ; Fri, 22 Jan 2021 22:06:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 92A2723B06 for ; Fri, 22 Jan 2021 22:06:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 92A2723B06 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 810286B0027; Fri, 22 Jan 2021 17:06:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CB8B8D0003; Fri, 22 Jan 2021 17:06:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63C008D0002; Fri, 22 Jan 2021 17:06:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 487976B0027 for ; Fri, 22 Jan 2021 17:06:16 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 07AF618215EFC for ; Fri, 22 Jan 2021 22:06:16 +0000 (UTC) X-FDA: 77734795152.05.grape25_5c14aad2756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id E1974180A3F13 for ; Fri, 22 Jan 2021 22:06:15 +0000 (UTC) X-HE-Tag: grape25_5c14aad2756f X-Filterd-Recvd-Size: 4550 Received: from mail-qt1-f202.google.com (mail-qt1-f202.google.com [209.85.160.202]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:15 +0000 (UTC) Received: by mail-qt1-f202.google.com with SMTP id j14so4592831qtv.3 for ; Fri, 22 Jan 2021 14:06:15 -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=ZmSrucdUhBu46ZsatxD272VvmrYXHbHQXvEQVOPVFEU=; b=JDtFLQtwZpSOlcpXvoiegOK8F+gok3Wrg4bdahuoJvnzjlztUWI8/tu0HwoAahyWFz SuMAD59Jc4YV+MW4krHJVsk1jE+ac1kDyUZohdYROpKcHil8MvDPKu/cgX9d+tddYNli wpJrMyEgUgHf4Gl6fIGqnWpdCnRQF0ycGcH3Km+3wNKu9/s2S7evr+8qszwhFwJA0JOP fFWu1C1KxcPTiuxbyxKvNNMJ1LPLAWNOnm4RtSeEnVNOzEnmsIuxqJ/13TEQIYx+gtWZ tfxYjqGTlkoK7uYVT4702Gtnpf5HhUpEyJLEg9t4j6WscLE5xiHCV8t1GjqZoKurK3Wj xjCQ== 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=ZmSrucdUhBu46ZsatxD272VvmrYXHbHQXvEQVOPVFEU=; b=S9gGkbfX07fW6J074Ik85ZNPl8EkkXiiVv85WMkIURm7wG3a0SnaExWY3v0d2PKJf2 gBYERTGrHxO2761k1V6XcCnHXK/JD9Cl4Sy+Uqa+6U9qnkNqQSbFqVnZqaiMkQX/5m1m D5bcKiv7/SUz0Hcc+A19gHQ0a4pKnCvGHMGRi0ejrC0HlNZvS/+8JflqDF1D6GxyGQzM 61GbMhM2J1gDofFosd2u5ET38XB7RGqNFkVFzEP/9AAJtjRkxm7ByWI4M7vcEmpC4aIc ZLEp7NPrGbR9iOuvIicx2TPfW5DfF+ocF2kATCKY7rzLDnaIkPF6w93u6yt/zK2f6ADo YGWA== X-Gm-Message-State: AOAM533v37Jcr4StiyRaTV7XPjbTqFErDebrD8JniKoyprAyu/92Dj9X +8TBYzJFo6+fQuAQ+VZS10E9mlvuA9c= X-Google-Smtp-Source: ABdhPJxJR1g9iiLV+Adnxv8KJCed9JVynK18YwF71dNdHoqsbIPloddl3FMXhTeuyv1+nKRZcSzzSROoTHY= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a05:6214:125:: with SMTP id w5mr496804qvs.20.1611353174742; Fri, 22 Jan 2021 14:06:14 -0800 (PST) Date: Fri, 22 Jan 2021 15:05:59 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-10-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 09/10] mm: fold __update_lru_size() into its sole caller 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 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: All other references to the function were removed after commit a892cb6b977f ("mm/vmscan.c: use update_lru_size() in update_lru_sizes()"). Link: https://lore.kernel.org/linux-mm/20201207220949.830352-10-yuzhao@google.com/ Signed-off-by: Yu Zhao Reviewed-by: Alex Shi --- include/linux/mm_inline.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 7183c7a03f09..355ea1ee32bd 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -24,7 +24,7 @@ static inline int page_is_file_lru(struct page *page) return !PageSwapBacked(page); } -static __always_inline void __update_lru_size(struct lruvec *lruvec, +static __always_inline void update_lru_size(struct lruvec *lruvec, enum lru_list lru, enum zone_type zid, int nr_pages) { @@ -33,13 +33,6 @@ static __always_inline void __update_lru_size(struct lruvec *lruvec, __mod_lruvec_state(lruvec, NR_LRU_BASE + lru, nr_pages); __mod_zone_page_state(&pgdat->node_zones[zid], NR_ZONE_LRU_BASE + lru, nr_pages); -} - -static __always_inline void update_lru_size(struct lruvec *lruvec, - enum lru_list lru, enum zone_type zid, - int nr_pages) -{ - __update_lru_size(lruvec, lru, zid, nr_pages); #ifdef CONFIG_MEMCG mem_cgroup_update_lru_size(lruvec, lru, zid, nr_pages); #endif From patchwork Fri Jan 22 22:06:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 12040739 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.6 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 D031AC433E6 for ; Fri, 22 Jan 2021 22:06:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 77F0D23B06 for ; Fri, 22 Jan 2021 22:06:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77F0D23B06 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 3F6D48D0002; Fri, 22 Jan 2021 17:06:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CF586B002A; Fri, 22 Jan 2021 17:06:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26F818D0002; Fri, 22 Jan 2021 17:06:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id ECCFF6B0029 for ; Fri, 22 Jan 2021 17:06:17 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A4CE65000 for ; Fri, 22 Jan 2021 22:06:17 +0000 (UTC) X-FDA: 77734795194.12.page95_1e173f92756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 7CDC0180AD395 for ; Fri, 22 Jan 2021 22:06:17 +0000 (UTC) X-HE-Tag: page95_1e173f92756f X-Filterd-Recvd-Size: 4524 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 22:06:16 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id l10so6933315ybt.6 for ; Fri, 22 Jan 2021 14:06:16 -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=sJrGKpeNyS1dvitdd7/CVnT7XOMWnD+nOyuu7AB/5R8=; b=PaYjsBYtTrDDzt5pYHU45kKGTmhrNTR9niMbhBSqDsMoox5X12em6igRycW0igVlgQ WxYjb5IAcekuqf0FhM7WgFy2xY1z+bc+YGS0Z/kFg8we4hH3dBYUIupKPSCHGlB4txuO oTjmO9rC5AhWBEOnbBUXuskVtfnPAwCd916qiG5SCaNKF18/GjlXAF9yZ3S3SjVDii16 u/BWgizAru+RCL2BfbWZYTvSVBowHENz8ukh55NOJD6/yQMuCkmzPxVPaXg8w/O2p6cv 6fxbrKTqoMoPsl7R++kGfJZo0/PWmHk+f/0pJcXc470nwx2TMgBJ5CGAKAOTdiJrHBsI OUlA== 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=sJrGKpeNyS1dvitdd7/CVnT7XOMWnD+nOyuu7AB/5R8=; b=QJZpzKGytJ+j3wd3i553iivOqWhutHK3KCdCo/r9EMGfL4OKDROdE93f3MywKOk+UQ YD0tdGDS4dKTf19AUcJZqd0ZXnCtEAlFb3N2Mi10tj8T/GmJGcVHIcLoLqDDuwQnj4MB sUqogvrsw/Kkep3DvIx+sNJMo9ZoxicFB3lgOQTNK4ZN8Q2x9RSMpEGo2+vsfxvelZrI yxybftivzGG0sbCs5DZr2/S/77D6hma+HPJPvvZJbkukHAtPwGQ0/y/EIhE9VJCbxffU M5BjNJTXjmB9iOp5yQKbO/pIHkydrWtB6hx6WgYNZAfCa/hS9Yryw0WTQIjads5dVxkR P7QA== X-Gm-Message-State: AOAM530BnWHLOcBHDk4hAN7E/4WQYHKxXPoTl+Ufx6MJ8T6S9SBAO1TC V4WOJSdXUnTbq/W/nr6n//e7bMAL+Bo= X-Google-Smtp-Source: ABdhPJyZ6IfKOqnLhsNxU/fgAPLEHfJH6yEHcszvuzoztIspZM4HsxAWYCZhYyJA4ml1smYkHtPKLVsvVGY= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:5129:9a91:ef0e:c1a9]) (user=yuzhao job=sendgmr) by 2002:a25:6187:: with SMTP id v129mr9256460ybb.318.1611353176247; Fri, 22 Jan 2021 14:06:16 -0800 (PST) Date: Fri, 22 Jan 2021 15:06:00 -0700 In-Reply-To: <20210122220600.906146-1-yuzhao@google.com> Message-Id: <20210122220600.906146-11-yuzhao@google.com> Mime-Version: 1.0 References: <20210122220600.906146-1-yuzhao@google.com> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog Subject: [PATCH v2 10/10] mm: make lruvec_lru_size() static 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 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: All other references to the function were removed after commit b910718a948a ("mm: vmscan: detect file thrashing at the reclaim root"). Link: https://lore.kernel.org/linux-mm/20201207220949.830352-11-yuzhao@google.com/ Signed-off-by: Yu Zhao Reviewed-by: Alex Shi --- include/linux/mmzone.h | 2 -- mm/vmscan.c | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index ae588b2f87ef..844bb93d2a1e 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -892,8 +892,6 @@ static inline struct pglist_data *lruvec_pgdat(struct lruvec *lruvec) #endif } -extern unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx); - #ifdef CONFIG_HAVE_MEMORYLESS_NODES int local_memory_node(int node_id); #else diff --git a/mm/vmscan.c b/mm/vmscan.c index 348a90096550..fea6b43bc1f9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -310,7 +310,8 @@ unsigned long zone_reclaimable_pages(struct zone *zone) * @lru: lru to use * @zone_idx: zones to consider (use MAX_NR_ZONES for the whole LRU list) */ -unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) +static unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, + int zone_idx) { unsigned long size = 0; int zid;