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 AB1F0C3DA7F for ; Mon, 5 Aug 2024 19:14:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 403EA6B0089; Mon, 5 Aug 2024 15:14:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 38CC06B008C; Mon, 5 Aug 2024 15:14:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 254486B0092; Mon, 5 Aug 2024 15:14:20 -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 09CD36B0089 for ; Mon, 5 Aug 2024 15:14:20 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9D0BC1C550D for ; Mon, 5 Aug 2024 19:14:19 +0000 (UTC) X-FDA: 82419142638.09.91AE9C7 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) by imf29.hostedemail.com (Postfix) with ESMTP id D471A120030 for ; Mon, 5 Aug 2024 19:14:17 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=2n+Zyvtr; spf=pass (imf29.hostedemail.com: domain of hughd@google.com designates 209.85.167.178 as permitted sender) smtp.mailfrom=hughd@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=1722885209; 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=d+yVWsX9O71c5CmAuQlWs0BaPbMW78Zm7yHDtPFLq7k=; b=ehLe7a4twUfbl2u8Ewk8WIBktoklO9ojf0KiC5W6bmXIldIejJiToX7ubIEoMGeOAhIpX0 xpO6GES0SaRCaGwCjMmubL0S/mb7pVBXB+VgLVblbfRDm/64xD+WflxS6jEw7yKrI8OOnX avP/uatFbP++Jfbe/fQnS11HT48jQZA= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=2n+Zyvtr; spf=pass (imf29.hostedemail.com: domain of hughd@google.com designates 209.85.167.178 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722885209; a=rsa-sha256; cv=none; b=lK6EdeLye66FF7esDzyNDvrpfZiTH47JmPFsPbw32E8IzMUVn3EultqxTye/oGKYLlJ5GA +FXQ8eNNbyARl1HtgYhrZKSuz83nC8GZ837uDI2lUi+IrF2wAPYuByBRYYu8jTcDO6ZeRr YvQUl5KdhTqgM9GtRAtgMCJgMgIFw+A= Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3db16a98d16so6908363b6e.0 for ; Mon, 05 Aug 2024 12:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722885257; x=1723490057; darn=kvack.org; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=d+yVWsX9O71c5CmAuQlWs0BaPbMW78Zm7yHDtPFLq7k=; b=2n+ZyvtrMg/poMsbORXzwcyrdfZs2806u1UFHF3jfzwrxPTFAJVTD8FYaoU5AKObO4 MEMCW8r/ZhyJGc/6r68qfhsTTukLYZFUioxlsFa39BFpC+S/zJmll6hBvpLDsZt5cKxp w4hw3lRSpc/Vunhb5CyOGvYcneTcr+Ji3SrL+f4BtnUYj9wq5PTvRJSDlvpB+WbA4AfV D4Ld/H9D9lnurKGz/BBXaM0Isp/9JV005HYlhGuqal1STNlZBm0hfWXdOp/nRQjTQTNl mcAhVaTjH4qrWCTEqxUZ3M5Jqd+vYkYyMzIjQIXr0UkOHhx+HUb7WTj8Fm+sM7c68jlY bmwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722885257; x=1723490057; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d+yVWsX9O71c5CmAuQlWs0BaPbMW78Zm7yHDtPFLq7k=; b=Ij9Z8Gc4C172mlfBD04ID5BpsQxoWz6PagqDhCoPa5/1MAE2pSQXXhm1M7h3KYhG26 rkKAgPUc7v2azz6NVwdCv2LieAi0K3wbNh0UO35b7M5tAWYhFOEh5Ave2VvX5T4Y5Dwu F1/G9fNoz2181OjsFHx0zk9gxcdcoknNtZeDi5RORD3qVN9o8Qt0sH+M0+qbXHJ081Tu ribj/0zpqLuVcYsbP4UHt/VahS2zuNSf2zZBRg4qrVw5UHcKqbq+d71a0cofEXE/zcRe 04ulxaSo0B/JeYXjoAwb/QkRxcqtWgYSks0tF+oakqQqrhc8BYtMHlXQriQPPNUo+aii un8w== X-Forwarded-Encrypted: i=1; AJvYcCWYJlUJKod05agydss5m+KUVAyq/XXrCPvPyVmn5Cknjdq5WMhzdIcter5+Wzf8CEXV+JdfqUSeoS8f0QBuWGCATxc= X-Gm-Message-State: AOJu0YxE/7InbrYRFdLv/CiCxmSnYe6TBjGZ0RocrpPJrwN3B6OSOVFi THxbx5Gu/tVzoM5zLgSHHoh+lBIiE/2Fp1cH2DOPj7Y9i+lRgiq+PDY3rLFR9A== X-Google-Smtp-Source: AGHT+IEN5hqJaUD8lfzfLj831X3oY9F63MttOy3VZvLij11/G54SgwjIXoBQ+g9I2rzPksdXJHwR4Q== X-Received: by 2002:a05:6808:2006:b0:3db:2afc:b19 with SMTP id 5614622812f47-3db55800e1dmr17493174b6e.12.1722885256559; Mon, 05 Aug 2024 12:14:16 -0700 (PDT) Received: from darker.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3db56362fa7sm2852642b6e.8.2024.08.05.12.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Aug 2024 12:14:15 -0700 (PDT) Date: Mon, 5 Aug 2024 12:14:05 -0700 (PDT) From: Hugh Dickins To: Yu Zhao cc: Hugh Dickins , 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 In-Reply-To: Message-ID: <9cf6f6fe-c2ce-3442-1593-c33ed77a82bb@google.com> 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 X-Stat-Signature: 5poy77bk6dcrqrq1qon46mpdwmwygtjo X-Rspam-User: X-Rspamd-Queue-Id: D471A120030 X-Rspamd-Server: rspam02 X-HE-Tag: 1722885257-572908 X-HE-Meta: U2FsdGVkX19TeP9UhgX7gEnuKMCPeaM5hQZ992PCCBhRS6YhUru2d75QJYQdIK2jn0iMwe8bQJZHcTvTmWCD8vr+6gkPGnIrsi2D2BT449DMpnpCdlczUmdSaYQtdtX0aVWpBWf9hhyEdThTe0EaoQnU5nYVZcqwQj8ddyY9zNhASwuh5vxhzod4WS57q9jap9YACFtGHsmWR6/cK2O1x65eZPxS8ihNc99JPp/QW14EHLF960usVPYW8w+6NsHFkYNiMDfhDplbofxR3O3K4kmJgZssib2ZPKjJfjl0wO7cSDePN70AWnSjSaOi9twKVJBfl+04j9+Ehiow06rbpmPAVk/lqhgkS8mbO2yJtoPC1p0JW+HW8GtDVKFbRjjeL7HIoJxwHBQfWWHIG6hbQwmtqC5eLS6vhM+1zxgOFMrDqob+XsMGAh/JmdFUdtdizxNVTqBpl6BcUVxXe3BK3fry/Q9jMrZ3imGFeVF4UJVH3o7CSSb5Bv5WuPpFOO++D5ub5lKlFwUicGujaX2lanvr7fpNVj2LeJMER18jm3Yx3XWjJeWuFD5J3apOTgkk3dQMqdtGi6+LLNkhi2lk+hq1cVgMH8Ep9h5hedt5R5yJtfpj5WvTgAzr+qmKoR5N1r62BVaoX6/kPeecDNydrjUvgTd0P8g1Vtam8IMcFKj23WG/n+L1/s+WD8BFqst/8Y4KmCv/3uYdmLFiETqdhLcOyW8b0WJ1igw7Ao0/xC3+xppL/uhJIBiYBbZO86eaExrQx/WG01L7hetmS2TySBmze91LuHBsWeX4w4w0K7OrJwbPkpvSmQAgRpNHEyi7iFJ7bL7PfM95yT0BEfj18G7rechSuysIgdDLLSeSZOCv3DhQ9hXSiagW+U9OYBBc/vWDDGwCerUE2ZP/ifYSXquV7C1dqb6GJnzNwJRQ9J2M2tw6dDFsbiZ6iepeETYz+xHNnwHl0JJjcVE1rQS 6itGql3w 8OlMWItsoBv5dFECS+FyK9K1VP4KnKa3019Hk48nA//aPAT90bv3D/vZOPJnpHByJHLOz3KYPTyAphOfcJhO7li2pA+sZUIVqyt7+wlHCTtQRNEowjaNf5r4M7UmThCk2ChASdqPQJ+QfqavU3b4xVumXLHSDLedyJ/xo+4tb+GTGyXujdWO8NPj5npvyBs61TCZzE3NiPWrsBpO169KAp/ZBvIDMEKn3d8G2ljF+4nNcjYVNPIPLaSRmfG+N18X/Z3Tu7Wz96sJ6VZYaLhEdimSONIKKD6o52MyNAXH73+qLG3EgyOA/xg/p65dBvanlpchj 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 Sun, 4 Aug 2024, Yu Zhao wrote: > 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) Well caught! Yes, I confirm that fixes all the bad behaviour I was seeing (and fits with my having DEBUG_LOCK_ALLOC and lockdep enabled on the untroubled machine, but not on the one showing problems) - thanks. But it does reinforce my opinion that mm/swap.c is more understandable without that macro than with it. Hugh