From patchwork Tue Nov 1 17:53:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13027301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23648C433FE for ; Tue, 1 Nov 2022 17:54:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F0946B0078; Tue, 1 Nov 2022 13:53:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A1416B007B; Tue, 1 Nov 2022 13:53:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0EB66B007D; Tue, 1 Nov 2022 13:53:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D09806B0078 for ; Tue, 1 Nov 2022 13:53:58 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B29F04022A for ; Tue, 1 Nov 2022 17:53:58 +0000 (UTC) X-FDA: 80085621756.20.55F6A24 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf26.hostedemail.com (Postfix) with ESMTP id 67258140005 for ; Tue, 1 Nov 2022 17:53:58 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id c24so14255203pls.9 for ; Tue, 01 Nov 2022 10:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sd/ZTZPQkq+Y0RGPTAhY/UhYvgYWKV9wt541wP0v/Zs=; b=SIGbKrtKugy7nOZmvoxKWK2XYfJQbfbGIzdFN5dvzfDZL8Ani8HTrXJSEa9F4u+AxM 06FrOunrj2wfzy6hsmYucv8fjbuQhY+ivEWN9s4XkzSo8Fw/pOK90thaglhNy5U03shN RhCEpAoCI+YwQ1hxCfu+jwh01kpoiZ6GPZzP5WDlCJnzf7APFvrvSn8WpjglC+98MsYo MFE0Almyut+ZmS2LS3VcUnkb8E6ubc7zK3Mpz821N86Fy9YD8VL1yUm9anQfuvtvfkfP 4JFoMdZGZUCWXoa6IdrHlkw3mQWpRk7i88a5kAJeDpVGx5OQcdSeBPqg0yCEaI1gjDOY N9+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sd/ZTZPQkq+Y0RGPTAhY/UhYvgYWKV9wt541wP0v/Zs=; b=38jtyG7DG3MUXj/nwESP2xLA6BRLw+vWaxbXUVdtvvEiBaCBZ7LK9kV+Yu9Lgk6n/1 L+Lb0nZaksQIXuk9InA4jbKvTmfqW3txIU75WnbYx4KoSD07MIpz9TGrbCiiDDieYAU2 1bR4P8SCpE8ReM+a0RgXxQPSkvMzPDLvuKescbjdcZTUvPCMfUKpbjWh8J3OkJUzogB0 T93+izFRoZOZycZQVh90Z+4NIFhEaZz45Vh5HEYrz1XXww6tW7j7+q8iEBoc72RYR3Bd 5HFINWQx2pf1q3IwSi8KyIihReXA1dwruKTUPB5Oz56BgbqFsiXI4Ip1jaWl2nf2Uccm y53w== X-Gm-Message-State: ACrzQf2rArKJVEoi7lK8+NMgxrbEHG8iMs1vSsYrisKHoPkWqdOwQL0e IzAZ2EDe1M7xVrvQP4RNMo2/pjSOdym9Ww== X-Google-Smtp-Source: AMsMyM6JC1O/v8aLCpaRP/DQaK1pXWU0tYXi0PNefL+TH1DnYBlJkFbjclImohZF7Wr316yRxNvZDw== X-Received: by 2002:a17:902:e352:b0:187:c4c:26ff with SMTP id p18-20020a170902e35200b001870c4c26ffmr17413372plc.162.1667325237185; Tue, 01 Nov 2022 10:53:57 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::8080]) by smtp.googlemail.com with ESMTPSA id e26-20020a056a0000da00b0056b9124d441sm6797987pfj.218.2022.11.01.10.53.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 10:53:56 -0700 (PDT) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, willy@infradead.org, miklos@szeredi.hu, "Vishal Moola (Oracle)" Subject: [PATCH 4/5] khugepage: Replace lru_cache_add() with folio_add_lru() Date: Tue, 1 Nov 2022 10:53:25 -0700 Message-Id: <20221101175326.13265-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221101175326.13265-1-vishal.moola@gmail.com> References: <20221101175326.13265-1-vishal.moola@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667325238; a=rsa-sha256; cv=none; b=j1uP/oDsdrLcnoGsd9OWKIXBZwIQGrvPLlAyJx6N4aMk0liro3FFTWAim3EVkF/nvwoneF AXePw+sTWh38rKFsQPJf3FUjGMhoAGpY6x18T5m26VdMX2w/Luaormj1HK6ZHH1cNAyvyx TcRYvun0H6MkIViNUTA/kNLBHgozT10= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=SIGbKrtK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667325238; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sd/ZTZPQkq+Y0RGPTAhY/UhYvgYWKV9wt541wP0v/Zs=; b=57wR0pIWkZZC1+nbmaaAV+OEHS/z0ocrotCJsya1m+eFsZzfiyE8gxpa/vG1ToT/ZOppRn aQVjIFuoenuJjJ0QQKcfO5QR0gj2IjYSLUWmqmiYisFII0rUy+0cYIPEwo+2KAssqYHaIs /ny255fqoM5zuwuX7rBqZ6lXkVWY6oY= X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 67258140005 X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=SIGbKrtK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com X-Stat-Signature: n31rqh8jmmfcouwgz8eamh4yxurrtkd7 X-HE-Tag: 1667325238-298636 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: Replaces some calls with their folio equivalents. This is in preparation for the removal of lru_cache_add(). This replaces 3 calls to compound_head() with 1. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcox (Oracle) --- mm/khugepaged.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 4734315f7940..e432d5279043 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1970,6 +1970,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, if (result == SCAN_SUCCEED) { struct page *page, *tmp; + struct folio *folio; /* * Replacing old pages with new one has succeeded, now we @@ -1997,11 +1998,13 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, index++; } - SetPageUptodate(hpage); - page_ref_add(hpage, HPAGE_PMD_NR - 1); + folio = page_folio(hpage); + folio_mark_uptodate(folio); + folio_ref_add(folio, HPAGE_PMD_NR - 1); + if (is_shmem) - set_page_dirty(hpage); - lru_cache_add(hpage); + folio_mark_dirty(folio); + folio_add_lru(folio); /* * Remove pte page tables, so we can re-fault the page as huge.