From patchwork Wed Oct 23 21:02:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 13847938 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 8BE82CFA472 for ; Wed, 23 Oct 2024 21:02:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DC2B6B00AD; Wed, 23 Oct 2024 17:02:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2175C6B00AE; Wed, 23 Oct 2024 17:02:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 092106B00AF; Wed, 23 Oct 2024 17:02:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D4ABA6B00AD for ; Wed, 23 Oct 2024 17:02:18 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7404EC0E8E for ; Wed, 23 Oct 2024 21:01:59 +0000 (UTC) X-FDA: 82706089746.02.4994612 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by imf16.hostedemail.com (Postfix) with ESMTP id 3AD21180003 for ; Wed, 23 Oct 2024 21:01:59 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=bsP87yrr; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729717224; a=rsa-sha256; cv=none; b=bKPEz9mByIz9L/yrg/VUO0l6qXK/2oQcPDCZ9eutEwH/Ar+XkuukM+pljR1ry8BcCTTMp4 TsgfLGihNt1w4NRRDe2WpSvuHd8yB7ZdjWCocxrrFydDIHgcn68rr6UWwh7wlfteJRNnxX jo0+OTw3YeO44MgejapJDA96Q7x98GU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=bsP87yrr; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729717224; 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=Ml8qGMnD8wyWC7ziO9cF4S6Zf0jnQsJbeVtFeepzb0E=; b=vQfkFACRHD1DaK0cP09aTouIvqIq1nYJVzlAWdyPSXIEQgIwmGpIrjskJbMVBi0tBwdOsL Tn+DJPUktfIazOEqS0fFblRDxaPO5++TE4xrEX7XPr0rAToux7jMZu227CMITNp7ZBmRlu vCnBeZI1xbgYTdu7vldcHUF0PhG75EI= Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7db90a28cf6so922962a12.0 for ; Wed, 23 Oct 2024 14:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729717335; x=1730322135; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ml8qGMnD8wyWC7ziO9cF4S6Zf0jnQsJbeVtFeepzb0E=; b=bsP87yrrnn/scZPp4tQfsdhKJ66rnp2K2vOm7uX09ikE8ZGv0LAIuKG94YISlIEAG4 8ErluC8JYrKshLAmR31HJ39eWN6S02qT94C/20LhpK6UwWD/jmAcJfLeXDl7URA1PJry PfMRleLOydTeh2KSTUzOsxOhrGcJOI85E29XfbwBjfV9OUqFfSBU4pyS0kVnHEwmMfoK 6dV+lAtqeIwJlkXTw9VmTsbxqHELoHA+zYDOkusx5aPxkqqy3wOJLyrampXlmtPBjZOO 0/f6IZQFUrEu5fDGBgEgmaInFsMDq/osu0RgRtJ3PFo2qrkzddamH2J2tiHoD0sobb6D N/wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729717335; x=1730322135; 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=Ml8qGMnD8wyWC7ziO9cF4S6Zf0jnQsJbeVtFeepzb0E=; b=wRKNlmIjXZyXy2gLz6XtQu/ZfrRH24Uq8xi+TIPYbG9PcEyvYkI0rJpKGOlB86nXo7 jwBuH1XvD+4v25rftoS7AFLDGyCujmeW6KtG0WbHwU4kn7Q8FhXv5P6z/uL/Id545YMH LtSoH9wM+C+bY2qoAvTcSmEY4ycUNlubhqu0eOfB/4IhFEnh/TddpC2zjJ6uuUC2bJbr rMIv6wNofGGqFJT/GsrWtdK7AtJ2uFmfBXTAiGyOo/NUe96CXHP17orzzVimkM3F3WXC KrDNXSS8vqtDLxqcXJyMEmklQP4bKNVtKHMTQNsWJmh+k84ipIo4QRT1OSLgWkiUlSgu oG8A== X-Forwarded-Encrypted: i=1; AJvYcCWQO9rpIH5LUNcTxmCJWEr/p82O5L47yMX/nbdOzhDlsYyF/y3woBl8bmKHi7kbseMlV1rQsaPDAg==@kvack.org X-Gm-Message-State: AOJu0Yzlw0UWtyTGEtezb9tG2KLa2vPZ2GAzOtY/qWwpfKnClgzEKmQu we1bvzeSOJNUHcgM0ATel+jF1Jb9tCIuIx8/WtdLTEH0Ju40j9WH X-Google-Smtp-Source: AGHT+IFB+OM5KwRnyuAHM7yiKyvnRK7TQLuhW1Tt7IcMYOwaYThOylgh1uhhjXLrV9fk5aGXf+bw2w== X-Received: by 2002:a17:90b:364c:b0:2e0:7580:6853 with SMTP id 98e67ed59e1d1-2e76a858bdfmr5720431a91.17.1729717335185; Wed, 23 Oct 2024 14:02:15 -0700 (PDT) Received: from Barrys-MBP.hub ([2407:7000:8942:5500:3020:9cde:9371:3772]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e76e05b884sm1942590a91.40.2024.10.23.14.02.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Oct 2024 14:02:14 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Barry Song , Chris Li , Yosry Ahmed , Baolin Wang , David Hildenbrand , "Huang, Ying" , Kairui Song , Ryan Roberts , Kanchana P Sridhar , Usama Arif Subject: [PATCH] mm: Fix PSWPIN counter for large folios swap-in Date: Thu, 24 Oct 2024 10:02:01 +1300 Message-Id: <20241023210201.2798-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) MIME-Version: 1.0 X-Rspamd-Queue-Id: 3AD21180003 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: mb9f87gka4rgr7u8hgofoiq3zieohs7x X-HE-Tag: 1729717319-132898 X-HE-Meta: U2FsdGVkX18jBe1YF7tIlsdUcLLSDCLbEXbrg5H1h/+BLcYLCi+bY12DZp0JzTdjB+bOykRPqFBGBxnV4jyGmMUqV+Twf1cwgRsUX0ITgwTal23j5sY/GZvQoHYXlroRoO0ZQWjtPnOOEq6xuhsklr/2qFrggI3nw62IMsEDyZQWouF17AH5y83n+qouNHr2odFspEJABuI/u9Y+cB6yaDTcvOQWns4DFzBXA5GaTgzAANn/D2mMmFMlDtyDX9kTpE00aPwC0+3tP1t7Qiqhd5c/YV+4kD1t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KLElaV6LHyqZWZpBWKCnD6fnQWw1yNNw5AmaA4t5+CzSf+FnznpVGMEm8aY0KcJXFfkMzDfnZL+KDq/6yxGnv4v+hDZXfgWUAIprD3LBfzo8c+mzTyk92JAiCkhqB8JOqfKuCOLUetX5WXnrsHgaCAH1q+xY1ZnaglWtvYsGoYGBNvFzs/Ltw7XAqSs+fT2OHAFM6Ix9MjXEmQVbsNj62htRABe4KzkVTpc1PI 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: List-Subscribe: List-Unsubscribe: From: Barry Song Similar to PSWPOUT, we should count the number of base pages instead of large folios. Fixes: 242d12c98174 ("mm: support large folios swap-in for sync io devices") Cc: Chris Li Cc: Yosry Ahmed Cc: Baolin Wang Cc: David Hildenbrand Cc: "Huang, Ying" Cc: Kairui Song Cc: Ryan Roberts Cc: Kanchana P Sridhar Cc: Usama Arif Signed-off-by: Barry Song Acked-by: David Hildenbrand Reviewed-by: Baolin Wang --- mm/page_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index a28d28b6b3ce..c69fab5060a1 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -574,7 +574,7 @@ static void swap_read_folio_bdev_sync(struct folio *folio, */ get_task_struct(current); count_memcg_folio_events(folio, PSWPIN, folio_nr_pages(folio)); - count_vm_event(PSWPIN); + count_vm_events(PSWPIN, folio_nr_pages(folio)); submit_bio_wait(&bio); __end_swap_bio_read(&bio); put_task_struct(current); @@ -590,7 +590,7 @@ static void swap_read_folio_bdev_async(struct folio *folio, bio->bi_end_io = end_swap_bio_read; bio_add_folio_nofail(bio, folio, folio_size(folio), 0); count_memcg_folio_events(folio, PSWPIN, folio_nr_pages(folio)); - count_vm_event(PSWPIN); + count_vm_events(PSWPIN, folio_nr_pages(folio)); submit_bio(bio); }