From patchwork Sat Jan 14 00:15:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13101750 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 5B989C3DA78 for ; Sat, 14 Jan 2023 00:16:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD0378E0003; Fri, 13 Jan 2023 19:16:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D7FE58E0001; Fri, 13 Jan 2023 19:16:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6EC38E0003; Fri, 13 Jan 2023 19:16:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B7AAF8E0001 for ; Fri, 13 Jan 2023 19:16:30 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 90F6E140838 for ; Sat, 14 Jan 2023 00:16:30 +0000 (UTC) X-FDA: 80351488140.25.7885ADF Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf13.hostedemail.com (Postfix) with ESMTP id 199D12000B for ; Sat, 14 Jan 2023 00:16:28 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=arrSrn4L; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673655389; 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:references:dkim-signature; bh=/KjcC4vdn0F8bwHPm7aH8/jU0gejjB6PredV8xmX1m8=; b=QIH8Gyi+8wQdj762L9qGzDLIVCfLkvYuXUT4sqFjJV12UmNTP10lU+VW461t5Fg5QxNNXu sk1Qb16eGRK5NgY4CK8o2hnop9cds0eOKDv5LKLCKDCMP99tMxwK5WA5/73fHsOT9md7tf 8LMbPFAiJvWCouOIZNcMeUaMVAeRzhU= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=arrSrn4L; spf=pass (imf13.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673655389; a=rsa-sha256; cv=none; b=k0YieJTtwjDd/FHX1/bvqo2W+AzQ6iqIdTLp8zK8s4iTO81LNLvogLquGLmlOVNRWiTsBN +3TFU2HDkyYieFoFGpjIyrb3ESlpwV7yIXBA/CMnbh21xar204yOhnPkPyBxOHgyuhjKMN z95NpWNZaLlmCEy3lSGzt1NTapmWRBg= Received: by mail-pj1-f44.google.com with SMTP id o13so20449430pjg.2 for ; Fri, 13 Jan 2023 16:16:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/KjcC4vdn0F8bwHPm7aH8/jU0gejjB6PredV8xmX1m8=; b=arrSrn4L+VBsJd77YJD8ctZh/KRnLsYulABJcTjOdPsLbpnHB3YR44IYBDCjYNq1tG 3kqEV2HjQiFgS5hPnM8e8aawAgoxrBDhUsejPDYvPmE8paMVjPiOAbxZGVsipLE0ORKF umVciZnOpsYKRccyQtgnMCi3LYllnDGScc8QmsyFH71obCJGtIhWvmdObv73mUrf05Hv orHDT5xtJjnIXsb+3dGi+z5yDIIfVmP3t9zt7pW2CeaCwx9zRdG1ZKMGEYC2CaPxyzlY VClZOxqKTSbQdPwuVkHoXgR6QpWzTXUxyAUCATUb7wnkrZaPmHSz3BhyfLtutzOd8SDJ sH3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/KjcC4vdn0F8bwHPm7aH8/jU0gejjB6PredV8xmX1m8=; b=lLFbYYrvLzYDF1z5dCAzh3N61Mmaj4BdsnUc3BF1v9Vj6V8jA8T1AiTVJ4QdJJRTot iEf4Uib02R+fqTDYG3N+W2xJZYgxN0QHOQTp1zGscVTH4l3TFiVKfjnD8X69JYnTS+8+ Y7HqN4eGpAFOxQjrDwGtuKD584eU29XhvWAhGmFj3UdTZRIke0fh43R3XQvv8jsJ+9FS 6T2hcHLSUDzIsbaTRyO9xWUWXsNvhYEZD4uq6u9tcIy/k/pBc8lDaPKO+wUH2+YZ3cIp 9QrNxHhxevC6rmh8wZiJAFaAIVxtwFC9x66EeC26O4/f/owTTWQPW+BdiDlsqOZkVjCG 0I4Q== X-Gm-Message-State: AFqh2kosaJJ5l7A0fkCoH8t+1zJbWEFuAPAqpjWKH8q5WVsjhmJI1L95 7URiC+c75y3ODZbSgLHuc3t4j1IVf0M= X-Google-Smtp-Source: AMrXdXu1WR7K6RyKti4hXxLv2+gB+N7RA/seu5IQRIR3O9VXK1EAKlIv6NrvJOxpNkqjKc4NH4o0PQ== X-Received: by 2002:a05:6a21:3944:b0:a3:754c:2769 with SMTP id ac4-20020a056a21394400b000a3754c2769mr96572284pzc.40.1673655387606; Fri, 13 Jan 2023 16:16:27 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::2e58]) by smtp.googlemail.com with ESMTPSA id nl5-20020a17090b384500b0020b21019086sm4064541pjb.3.2023.01.13.16.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 16:16:27 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, "Vishal Moola (Oracle)" Subject: [PATCH 1/2] mm/khugepaged: Introduce release_pte_folio() to replace release_pte_page() Date: Fri, 13 Jan 2023 16:15:55 -0800 Message-Id: <20230114001556.43795-1-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Stat-Signature: uyftq86gx5aeje5mgzdgzaxitufwgi8z X-Rspam-User: X-Rspamd-Queue-Id: 199D12000B X-Rspamd-Server: rspam06 X-HE-Tag: 1673655388-663457 X-HE-Meta: U2FsdGVkX1++Hfk8KDUYsyLJ8+Jz9Iv97rF7ibfjJxYJiITvIYXRpbSbgn1rNY6cSPpTO8ZlC2miXW4JrmRcKNPyINdDJz5Nkvox7ZQ9obwhtfW7+2+H9Etsh+4I0E/Etx0GBBKnLcvI8QdzhPlhJpq5zpytKCm9oxJI2j9ILCnGID0Y7wg3RhmMADF8f65g/uB9alQqGwifcDN1cvcdLLLdkkP60RsQMXsEY8D7verWnSQbF2lql4itiDDbQHzGakqaenFo/nLCI3Yw2BPSjliEIe5bDf0Rd1NF2uOv8IeTpbv/eublvTLWhSSflsxYk+27gCkzXXLjmWvWQbyFlvtda2Fg8KSo41kzG+4H66Vzr/Q/A97UmFl84x5G/nCSGg0/vDAAjhbIzW/vDk7JXzoAuk7qC7LPy+lW30X4Q75LYU7tD/B1jz/2SoudboAljkAnRwGOac4MgNfn4H+H2kRnfAegYWP+yqr812FDlY9CS5UUtpDpH/519kyjISYIs5z7tsqzQpuGz5cD2Jwb/ftN74yPrqgucjVFH1KuNNyBbaSPe+cTYYXEx68pLif8vBGHJ7tVmG+4uY7Gq0aDZ6JI9djdT4nJfNxz+sf7f4ddsQ66YzaPv3zIy2uXfvBpXmmHwosIOOLiyakjyLxS4HwUt3i8A8HExLb8XVUonpfOFmxLQpimpWtYL2x1dJG0TKYhpPIcr1+Ucv3QjoSV+IKTBw94hZO5HUt8Z4d6v6CFLOM/wuYr9HgMZCiynm4DP9fzinB4gZEuletXvtd24SHZU5KVikN/S7Uar2vZ33mNBP50bR+iVRWe7RzzEXnMPPgl1X8QAdrnYeeGRICJ2c9RwIhwf8UNy3/tm5AcIGeupUBiyjANYnJxOfSijA/aj9ud0GjlwaaztaDMIXEubtzSMkNTf9/aNINwHhJxhOcmQ0uDs5iVsHniE6WtmGlo61CXD/xjT2T90kG9tyR LupjWuks LjWfg4XeWiQCjHCY1kR8zmhOO15fUi1T7EfYLxJ6ipbL0F7AzFMvgbK4tmRMs83Crbd6p8Fhk4jjAj1mEO2gODGGQ2Cz29Nvfk8cMxXXqaXJSdrzTVAidWW28U8A0/iMVDFDmoD+LufHNLqyCaSxVqlNpTLrcDkOwVFR7HEsFbrf/jwUBd0iWuKkrXUhM9yyFVVzNmbe67wFl/1LqDjNvwSUNk+KUTeozE3SUtpn1eRCir4i5YzS7YB7vJx/bK4Rk+2hqctSnAYObndG1Xss5xe4VYg== 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: release_pte_page() is converted to be a wrapper for release_pte_folio() to help facilitate the khugepaged conversion to folios. This replaces 3 calls to compound_head() with 1, and saves 85 bytes of kernel text. Signed-off-by: Vishal Moola (Oracle) --- mm/khugepaged.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index e1c7c1f357ef..4888e8688401 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -492,13 +492,18 @@ void __khugepaged_exit(struct mm_struct *mm) } } +static void release_pte_folio(struct folio *folio) +{ + node_stat_mod_folio(folio, + NR_ISOLATED_ANON + folio_is_file_lru(folio), + -folio_nr_pages(folio)); + folio_unlock(folio); + folio_putback_lru(folio); +} + static void release_pte_page(struct page *page) { - mod_node_page_state(page_pgdat(page), - NR_ISOLATED_ANON + page_is_file_lru(page), - -compound_nr(page)); - unlock_page(page); - putback_lru_page(page); + release_pte_folio(page_folio(page)); } static void release_pte_pages(pte_t *pte, pte_t *_pte,