From mboxrd@z Thu Jan 1 00:00:00 1970 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 6D9C7C3DA7F for ; Sun, 4 Aug 2024 21:36:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF7166B0085; Sun, 4 Aug 2024 17:36:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA7106B0088; Sun, 4 Aug 2024 17:36:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A47336B0089; Sun, 4 Aug 2024 17:36:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 880C36B0085 for ; Sun, 4 Aug 2024 17:36:41 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EE1EB40321 for ; Sun, 4 Aug 2024 21:36:40 +0000 (UTC) X-FDA: 82415872560.26.E39D134 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by imf16.hostedemail.com (Postfix) with ESMTP id 28D83180005 for ; Sun, 4 Aug 2024 21:36:38 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=4yRo+n0J; spf=pass (imf16.hostedemail.com: domain of yuzhao@google.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722807392; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pm0EQe6cqyEwEGwUeusTWSiaU01FEzLSnQnEeovsSh4=; b=jlgC1UvDetEo54DA8hTkZHdCa5EpRfYdk6445Vdfp2zFcdalhfr3Itp885DlclQc7Kd7an Yy9fLs0AEBVGgOWA8cr4Qu1SmHKHIWVH0IOhR4GT/9NqWd/uYbiF4YHY1Skec0YiQpsPvO 8xus3lck63y28TjfEryFuDo9SlUgDzs= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=4yRo+n0J; spf=pass (imf16.hostedemail.com: domain of yuzhao@google.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722807392; a=rsa-sha256; cv=none; b=4pp5PoF/f5WCQ20S3YH9rz0clE0f9AC4c1OXHiVTiElKAzy4NowfvRyeIgRcCnxWC1Lc/d ndeIU8eGz0kL8hy9RD7/J8RQmQ93/r7NSegyKkWbZuVOC+BAkNaT5PhrY0HI0umrESrMev gsEgY19L36M1S7AaRlrYk1mhIDmzgyU= Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-44fdc70e695so1873421cf.0 for ; Sun, 04 Aug 2024 14:36:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722807398; x=1723412198; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pm0EQe6cqyEwEGwUeusTWSiaU01FEzLSnQnEeovsSh4=; b=4yRo+n0JLSSaAjwCk+hNOgjYZkpBPM5fk/NWudoO1+woYFr+nxcWJLLlz+bTxGm+IR sdhPcBaCTOiWJFTWPK/gXYkHzXPsNUru1xXkPXSKC22lBodn0kwy5cQXFslmPD54v9e8 t6XDEDhBEy6AoOB/Abzad8APzMDlRIS4Zri494iAn0h75rOpnY9Wgvxy/6fjWDxv4oq8 ykDYZSHhflOcn1cgocjxd9TMWZ6HISMOfUuHFDUM9bnILUAtKrKB2VdoSM3yrjpOoBhz ScwVuvWam0GdE1Q6uWq2LjSZpx8fn7N4xT8kb5tWI64OGzUDzX7EzyNz3KTkoswFOtUl 3HrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722807398; x=1723412198; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pm0EQe6cqyEwEGwUeusTWSiaU01FEzLSnQnEeovsSh4=; b=rrqkCXIFUSin9JcF0JdRYfKAmdBjdXVRHZ37Sb4wHvMaada0tSMeWCWM/K/Rfuggu0 gLE6M2nW/IP8srjoYCyCGZW4CUrXaZj2VC5kbJh7OIjmibc4GF0IrvFO7UtzdiDa4uXa WTW+YMxk6jkRRDLDBl7bSpw8udpNrLMMYgY3OjZDLpPNeKLWadKpg1rDnCQbQtUnVx5H sUtZoIE8Ex1jTm1IxvKZyMHgLCXbmLx9wVtQRhKPKocUBLaYBr/9VyZf5xQdIDsJiJod mG+fsNfJJ6RsgCLaNLlG90cnxLj6inu9afv7n84o+Qj7oDgQISwMm+MAcvquovF11PTJ GCjA== X-Forwarded-Encrypted: i=1; AJvYcCVqkaW4GmbG87M3AC/J7O9GP8RIgKVRr0LRhfntqtVPFzF3tREXfhiWpXgfNzkm4rusBj6LR3KQGyCuoITjExSifl4= X-Gm-Message-State: AOJu0YwlNiiuxa446M7kOy94QDzvcutJlTpGQrBt/F0ypHW1SXdhXMCE 8t0I2SITUI/Okz+DhRlyO1BHJL+hy0Hzdxc/iGCsRQ7UBn2iXDsk2/2Df8cXxg== X-Google-Smtp-Source: AGHT+IHF4cYuR9nH/fmhJovpmdm1W3c1Oo8PRMo0vGC1+crL4As5vBcywNlgSK3EOIFJcthYcEefQQ== X-Received: by 2002:a05:622a:198a:b0:444:ccc5:f4c0 with SMTP id d75a77b69052e-4519b45531emr2747161cf.15.1722807397872; Sun, 04 Aug 2024 14:36:37 -0700 (PDT) Received: from google.com ([2a00:79e0:2e28:6:3617:5ec9:bfc:ae3f]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4c8d6a4b04asm1430115173.154.2024.08.04.14.36.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Aug 2024 14:36:37 -0700 (PDT) Date: Sun, 4 Aug 2024 15:36:31 -0600 From: Yu Zhao To: Hugh Dickins Cc: Andrew Morton , Barry Song <21cnbao@gmail.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH mm-unstable v1 5/5] mm/swap: remove boilerplate Message-ID: References: <20240711021317.596178-1-yuzhao@google.com> <20240711021317.596178-6-yuzhao@google.com> <714e77d3-f629-bc06-4808-f7f33ac6872d@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <714e77d3-f629-bc06-4808-f7f33ac6872d@google.com> X-Rspam-User: X-Stat-Signature: 1y7hgn4gemnjcoizjqc5aqaqpcxd3amw X-Rspamd-Queue-Id: 28D83180005 X-Rspamd-Server: rspam11 X-HE-Tag: 1722807398-52930 X-HE-Meta: U2FsdGVkX1+n4vHrqS7ih+tdgAw6A4Y/p3a9gg8BfFfxXJnRY3RxuVvssAyAxWeEvOS6igLu16vhUrFhWc7grkHcocdOTCRJrck0ux6bBpWqcOsLbKujsRbEnZ4nDXpO9WL8v4WHhwMpRcBj91+chnMQn1iAfEAkGqisWaGbzfoUXTnku1EdT357swcXlJRacT6EDsnMi+UjzO/8M53BVxZ61zHlWvQoI5hQ+66imk97BSESNG/c+ct0XsOFiYYj0mtIiM2x5kEgJStdXsZIcd8fG6kRI0RjejnkUtKRWhjY398uS2NOcco451lzaVHqlFG/t7OWHyq6HFG5RYtEJSD9M3Q/Eipr9sP8jtevt73WXzGVlR/Ma9q+gMA5LhbJvMEp29w8heUVN6wzjDc9x6RmdTD3Z2HmXLM4yk96pkrHpAAzE9AvSDA8pO6TYE/+Vj+O06Bv14f0SPWPpleTJPDv5bG6BlHz3FIWh4a8JcsHWfr7mnbj/6atZPgCdTWJHtRFgRGfaE0eBmHxB7ZE63HFzt4NoFbeHvuuJqICG12P2rJ7zopWeDvv02DB+1iq+Q0ur32tHSTa0fZ8uweFGilIIp12pob/ienKTg4F6w/l7Z+/R1vpOX6PY+y7P62y26uV2hN5YRtl2XUG+8g2xWde4lA22EpM5Z6dM91Qjmie+vyKSJ6qUB89lZOPRP1ZQNR0/ln4yP7LNxfqrZgZcP/4HZSgLE5TupXxEOZsuaUIb/cuvLn4t68QWCNdzALs/7MgukE3FAGzNAgu7cFaDo7m+X9tYd6zLTyRUhvHHKOrWcOVeD5Olne7IIjAWrcW+a2q+ol7h19WerbhqbZQDH4fNfajcA224o4nTYX7kurL3Uf1L2VwrE+or3uFC6dsk8TYi60y39Ebe+iXpLRq4dnSAcHgtll0sK662a8QhzZNv+T7iftJGWw8r3n4S0XPWUxUhwoEQ+p3ukNbyZ3 tJV1rPoz cX3RdfM5H8aF89wbuoSd3tfect4yzsdzDg+x1sz8j1rP8Z79dbSl2utw1oPK41mIPy1EGptdxf/eMdY9m6d0biTXa534skBuByoX3WTwEyMnb8HVKygkioeqJI9EEKka+Zot71h3iYwbCinQxAgjSLNPScoyDe2C3u8p7XSgmrEgKol6HxHfnxgACkl4mSVyIkSKzKuR/io/y+gADEMBsTeMA2B7JH1sj2AIHnGuDAKTdabJw3ILgS8xe6qQjpG8zL6l/F0/phlWbzcEE+RLGXVOqyaIJqzQBAJ7oL0+avZc3SHququvnMLGMqIFTWhPnj0gHmTWUIMkDjmA= 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: On Sat, Aug 03, 2024 at 11:55:51PM -0700, Hugh Dickins wrote: > On Wed, 10 Jul 2024, Yu Zhao wrote: > > > Remove boilerplate by using a macro to choose the corresponding lock > > and handler for each folio_batch in cpu_fbatches. > > > > Signed-off-by: Yu Zhao > > Andrew, please revert this "remove boilerplate" patch (and of course its > followup fix) from mm-unstable. From the title I presume it was intended > to make no functional change, but that's far from so. > > Under tmpfs swapping load, on different runs I see various badnesses: > "Bad page" in __free_one_page(), Oops in __run_timer_base(), > WARNING at kernel/workqueue.c:790 in set_work_data(), PageBuddy BUG > at page-flags.h:1009 from __del_page_from_freelist(), something (I'd > given up taking better notes by this time) in __queue_work(), others. > > All those were including the fix to Barry's report: without that fix, > the boot is drowned in warnings scrolling past too fast to be read. > > (All the above were on the HP workstation, swapping to SSD; whereas on > this ThinkPad, swapping to NVMe, no problem seen at all - I mention the > swapping medium, but have no idea whether that's a relevant difference. > In each case, MGLRU compiled in but not enabled. THPs and 64kTHPs active.) > > Sorry, but I've put no effort whatsoever into debugging this: "remove > boilerplate" didn't seem worth the effort, and my personal preference > is for readable boilerplate over hiding in a macro. If you prefer the > macro, I expect Yu can soon come up with a fix (which I could test here): > but for now please revert "remove boilerplate", since its issues get in > the way of further mm testing. Sorry for getting in your way, Hugh. Apparently I didn't expect local_lock_t to be zero length, i.e., when CONFIG_DEBUG_LOCK_ALLOC is not set. So that might explain why you only had problems with one of the two machines, where it failed to disable IRQ when rotating clean pages after writeback. The following should fix it, in case you want to verify the above: diff --git a/mm/swap.c b/mm/swap.c index 4bc08352ad87..67a246772811 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -254,7 +254,7 @@ static void __folio_batch_add_and_move(struct folio_batch __percpu *fbatch, folio, \ op, \ on_lru, \ - offsetof(struct cpu_fbatches, op) > offsetof(struct cpu_fbatches, lock_irq) \ + offsetof(struct cpu_fbatches, op) >= offsetof(struct cpu_fbatches, lock_irq) \ ) static void lru_move_tail(struct lruvec *lruvec, struct folio *folio)