From patchwork Wed Dec 7 23:01:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13067738 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 AC211C4708D for ; Wed, 7 Dec 2022 23:02:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4432D8E0007; Wed, 7 Dec 2022 18:02:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A53A8E0001; Wed, 7 Dec 2022 18:02:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F8538E0007; Wed, 7 Dec 2022 18:02:04 -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 0A70A8E0001 for ; Wed, 7 Dec 2022 18:02:04 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C4179160F08 for ; Wed, 7 Dec 2022 23:02:03 +0000 (UTC) X-FDA: 80217034926.18.8EF806D Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf03.hostedemail.com (Postfix) with ESMTP id 2172A20021 for ; Wed, 7 Dec 2022 23:02:01 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=QWjuDvsx; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1670454122; a=rsa-sha256; cv=none; b=iDAlohD35FIFyI8jndppdocSjfyAea9b0CbHhC+oEnUZjGb/FOWtwimhOtM4Gj8RV8XBV+ gMRqYc1EDp6DHtwtFf4RKqakiXXYd5AWTU0U7LJ6Oo0VBw2TGWfrhtEAoEvDTU02G1vpZQ khFAmixQ7W+M7lfVZLSFDZV8L0cr/qs= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=QWjuDvsx; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1670454122; 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=nurryG7gVBJWg4R3e/q3KZp9RxkJsYW9MoP7t/y1faI=; b=MZmmvd+2bF7XMS/fkV6hdiRIDdZUMWGjaiQE5kxCvLyYeu605xzD5thbYF+GUaJ6nvTYTO A+1h/sC1/FbMQ0z+ux0arFJ2KZZuh4rO5FoKRg1DalPnPaeDq3GpcBT5+qvHFIffxHX4+M kL+ZO3StDJEH9rPLKnKEDPGcpLL+T7M= Received: by mail-pl1-f179.google.com with SMTP id y4so18478953plb.2 for ; Wed, 07 Dec 2022 15:02:01 -0800 (PST) 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=nurryG7gVBJWg4R3e/q3KZp9RxkJsYW9MoP7t/y1faI=; b=QWjuDvsx7JlXe9jXENwXVfaXVWdDN8pp2PRVifSfiC5uewfqCcXo7a7QY5NClKN4jo XIYubaBMmt41X0S6tkEosOyXPlmKpSnefXHj4lrdnAshM3ZqoRsqR/RWso9mHzpVH2EP iyucwJCvCzBxNiS0DZOrs2OZQscCfv+Vqs9jHd/QNNIevSm+PEY54R+KQI0Exh/tMikx qtdFlLWc4RdRRyygzeNnWWu9/2rHRjBFNCd+iV5E2Thc6eAcGtYHsG3IJk4RraRP8FB6 kttIG2u/RDgKJ/UB3+uT0UUAbXapXVCFd+u44YZpTHrUfNzXtdq4Pif7xxDj1ewuJ6pR jg4A== 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=nurryG7gVBJWg4R3e/q3KZp9RxkJsYW9MoP7t/y1faI=; b=mr07qdN93zgYUb8AG/0uRs2OFk77TSMBhqcijCbiifA3G3u1VohdYL9TNsyqMLZQA7 pznjdhi4yWHawm6mYyqNmgILTBLEHIfHJ/AHikv7ed/LgI8zfUUe6JkedDhaJYd6QSML G/HnxiJ+mXdUbcT/ykT5JZ808m96YrhyfjpFasK83HTUuOYBwcytstCN8CpUj+/UdZpd 5JDFDCDW9ntNE4vPwBmxwdCgcbw5Ybu4HRUfxzmxoHxAjH91AQlBSXwNXPW6XZIMOiJ5 i0JZDEpTWsn2rUk/lheL5F8nWZR1PsCjHvVOTE9hk45g8B37MywpMZdpBb76dG6Oo4Ga Nbsw== X-Gm-Message-State: ANoB5plunwS+jHwmYWknjCm5Yyue/nYeAAy2oNZw72qcmrzl6oh9B4tM c8iTyVfybjd4Vz3bm9cAgYDquiJhMLFXow== X-Google-Smtp-Source: AA0mqf4LqJeISyz/cbhdlvWeu+sYEbZmsVtecPsU/yjTK5+i5Cv6K7CeBXEmtSozwv/WhsZmrZ747A== X-Received: by 2002:a17:90b:1913:b0:219:396c:9e30 with SMTP id mp19-20020a17090b191300b00219396c9e30mr1056306pjb.20.1670454120814; Wed, 07 Dec 2022 15:02:00 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::2c6b]) by smtp.googlemail.com with ESMTPSA id pc16-20020a17090b3b9000b00212cf2fe8c3sm5411033pjb.1.2022.12.07.15.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 15:02:00 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: damon@lists.linux.dev, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, sj@kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH v2 3/3] mm/swap: Convert deactivate_page() to folio_deactivate() Date: Wed, 7 Dec 2022 15:01:52 -0800 Message-Id: <20221207230152.22938-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221207230152.22938-1-vishal.moola@gmail.com> References: <20221207230152.22938-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2172A20021 X-Stat-Signature: zoshky1qskx5b6fc57fp4j4z7dmbjn97 X-HE-Tag: 1670454121-507899 X-HE-Meta: U2FsdGVkX18Yap6Y5qnsH/uDFoqxFsyZ3rlm/y0laHurNHrp8u1/7NXYKqY1bwYk970EY8AOs5uqkbxdb+8UJEihRrdnIWcO/f9jLBhJmVRapWPK8FlL/GJX9z1RCk3ujoHqQZwgE3321rkAPXkuLzLmQcaiedIz9RX4UdDPdlqW6quWOQlDgW0musPNFl3LTxYTOJY4m/VJET+4lq+lLXAOIoWYMdPDaJ9uD15YiCNshcPER/diAlQLSkXZNKOLZqk1OP+4wr9HCPPuoiEZXpTZ0TeUNU7nhhMo03yJOD7Lx7tgrOEbBhHFZbh9HYpr/fKZV9pIaMpZahhJHJf/3Q2Sqp917205r/aQJSECWWFCpFa16eBP6aspMVuZ3qvtgwyXYhJPzS3qZ54Ndlrt0svX5Za+n3Ia6GZZ+toVTPzDRlLHhKeE2CEmKa2Qx+wzjGeRoo4/rR/yQsEhu37h7G2DOqMJusTTLXg+emD2hCMXzLYSrnmDF5MElgvSm2dRcKVZlP68SzXhhqXrmgByr2ijgAs5+NcLopi+tWYOlwt6UFDCjB56iL4yT9iKJafqUsdkww5eq9+Wd1SbNXnhczSrHEjh/zOrFrAveIc0A2Is661E1lNBobyFkCHtCqhQrb8e0+siP1GBNL68IPZB3Sd4mBwh+dwZKbiPRX6mROoHny2dXRdFnZ/ZNC/pbttwW+6zqvPzcnUDqXzMNZZSqLpd+eSIluv6FUlwGYdvSmlNdUqScx7zVS26fjZPq8ZNJu1LwBpCg+UT6zF57pSopnS4CDte0sPYnh69BLDLGG4aiyTkTjpGhn0sfjYDITEzeqAChQeKd0PhERwU0ReYuPqP8FyitW04ZHKV99EKo84rbEJz2uX0gTftnyEO9O3a7+PHSXMpRPp0FEy4wco3UuYl2Ovb1eyrmWf01q+Ad20tfajfpfp/RoP1YrLo4SzwlQgWA1P1o5D3vL8zbFa H1DvbKqR QngGwaAMRfc7xkxfeTyetUnWewI9VeS/EqgK4EPwGWwDqVCiw04WiHHn/RGhU1uQ/SI4NMGSDXbv2zsP66JrSV1GLUbmKDBrXbjabrwW6KgsO7Ec4KZUA6xYJLF22apPJlrqKQHqIfFTN3/3Qo3Fbzxt9M98KRryO2shq35k4B0XwrYoOKEI8DUFeeqBGkkbK3/33Ncw5hFViL01CYFqJi0sxo4voyg+M3o60Do1f/AJ7DD297XPjHEyu3QuR333qDG8KmkdxFSAfJYX7grORyCKH9A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000633, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Deactivate_page() has already been converted to use folios, this change converts it to take in a folio argument instead of calling page_folio(). It also renames the function folio_deactivate() to be more consistent with other folio functions. Signed-off-by: Vishal Moola (Oracle) --- include/linux/swap.h | 2 +- mm/damon/paddr.c | 2 +- mm/madvise.c | 4 ++-- mm/swap.c | 14 ++++++-------- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index a18cf4b7c724..94aa709ed933 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -409,7 +409,7 @@ extern void lru_add_drain(void); extern void lru_add_drain_cpu(int cpu); extern void lru_add_drain_cpu_zone(struct zone *zone); extern void lru_add_drain_all(void); -extern void deactivate_page(struct page *page); +extern void folio_deactivate(struct folio *folio); extern void mark_page_lazyfree(struct page *page); extern void swap_setup(void); diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 73548bc82297..6b36de1396a4 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -247,7 +247,7 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate( if (mark_accessed) folio_mark_accessed(folio); else - deactivate_page(&folio->page); + folio_deactivate(folio); folio_put(folio); applied += folio_nr_pages(folio); } diff --git a/mm/madvise.c b/mm/madvise.c index b323672c969d..9667d052b52f 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -397,7 +397,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, list_add(&folio->lru, &folio_list); } } else - deactivate_page(&folio->page); + folio_deactivate(folio); huge_unlock: spin_unlock(ptl); if (pageout) @@ -487,7 +487,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, list_add(&folio->lru, &folio_list); } } else - deactivate_page(&folio->page); + folio_deactivate(folio); } arch_leave_lazy_mmu_mode(); diff --git a/mm/swap.c b/mm/swap.c index 955930f41d20..9cc8215acdbb 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -720,17 +720,15 @@ void deactivate_file_folio(struct folio *folio) } /* - * deactivate_page - deactivate a page - * @page: page to deactivate + * folio_deactivate - deactivate a folio + * @folio: folio to deactivate * - * deactivate_page() moves @page to the inactive list if @page was on the active - * list and was not an unevictable page. This is done to accelerate the reclaim - * of @page. + * folio_deactivate() moves @folio to the inactive list if @folio was on the + * active list and was not unevictable. This is done to accelerate the + * reclaim of @folio. */ -void deactivate_page(struct page *page) +void folio_deactivate(struct folio *folio) { - struct folio *folio = page_folio(page); - if (folio_test_lru(folio) && !folio_test_unevictable(folio) && (folio_test_active(folio) || lru_gen_enabled())) { struct folio_batch *fbatch;