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 2E3DAC25B7C for ; Tue, 28 May 2024 16:48:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E7286B009D; Tue, 28 May 2024 12:48:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 996446B009E; Tue, 28 May 2024 12:48:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8368B6B009F; Tue, 28 May 2024 12:48:09 -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 64E696B009D for ; Tue, 28 May 2024 12:48:09 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E64D6A0680 for ; Tue, 28 May 2024 16:48:08 +0000 (UTC) X-FDA: 82168387056.04.34F3D3C Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by imf10.hostedemail.com (Postfix) with ESMTP id C0557C0004 for ; Tue, 28 May 2024 16:48:06 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=aFtX+syx; spf=pass (imf10.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.167.171 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716914887; 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=U3V23Z9MHF98bputd9ikCjavb4rb3AREJlWKoHJal/w=; b=TxqIIeUYFl4UDc7Ujx3btsulpu5WLPawUUUhud8JUJ+nILkbqerxbVOko+JO+KkPUyUBPP gMhDLFLZA6u/aUKYxqfjTChw0044ZQ0KIDsrPTEQMLPRpbccfrISbEv8HsQRnTCSbr3pYI bz6owrjjSJ3oS+ulf0xvBRxLuhStoHk= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=aFtX+syx; spf=pass (imf10.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.167.171 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716914887; a=rsa-sha256; cv=none; b=Bv7KkuAi1hxC24LgVn1suEb3VEr6IF7VUuKjujkNPsupn0gJz3I9RA3AsjPcR1Uyfmt+Zl zBnDxFTMEszcb8XIgBGBbvrOLQWz9++awJELfL3BxvOMrJMEhc/rjiWDcJWYwANVOc+vO5 qBGN420GoRB5hPtpZcLsa8UTV7rFZz8= Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3c9cc681ee0so485485b6e.0 for ; Tue, 28 May 2024 09:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1716914885; x=1717519685; 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=U3V23Z9MHF98bputd9ikCjavb4rb3AREJlWKoHJal/w=; b=aFtX+syxEPj9EwJ0FhozAGCe7vVYVp8iNhZvB68J7Pvc916HOnNNKPRGgHkp4/OIZO QRelY5GEFe9tByIrV3RB5nL4/p4U80BkFLmeNIigysclUttxf0V00mtTPLq9FUDco/MG NdjEVcoiKXRZylTzVbdDl1m/nQVhBaW8sO6uuHQej08ZqiUAM6Je3kmGoG1ErHXjRs/0 m7Qs5IcREE3TZ0v54hN+m0WfCkvVIkjRp6zfuPKRvRMtNeOoEAoitk8gvaHZd/4X+Bj/ Xr6TcsVQ6BaUY5kY9BsmByA6YOzwJNqZ2ij7clvf6qJSyBNj8DeIKmOZuiSEz+o6FDFu yiOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716914885; x=1717519685; 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=U3V23Z9MHF98bputd9ikCjavb4rb3AREJlWKoHJal/w=; b=ZShDo/VCGGq9rbmoyYUOhXZt8OoOo9JPPo2475UYLmM54WgtTYqnAYjy/dnDjZ07rl 5Aa6DTqrBwAzGDT0U8bJj3+kx1rF7qQqLuqGaVY2lnnoo3xrQPhXCBHhxQ2iePWC2Box i3JWW1irPZKxwSCaNCyegbcHMTaGxq5CeEpaMN2MdndktCziBdJ8LwcwEps2SHA4aM3N WpnLq5uiobKDuxhgms2gZ0rUVZZP8A5TiLJIeRe/sOi1m6Salz69Zsm3aPJBoPXH/irb 2oC82o9YIzs/OX5FlDqujr7XF6EkgPFrxnz4Cm3ni+/j0huELexLMWW7MUAo57rNAl1f Y2bw== X-Forwarded-Encrypted: i=1; AJvYcCVFbCR1J0XiK3mZvMmfxTlKlfZ6kjrkgUNwdJCENLWhdeXFv2oFN8aiZtKqNEjf8JrborMFIOThOhPu6jfskmIrb7I= X-Gm-Message-State: AOJu0YxG/VHZjMR0Zkh7YJkiun6mwW7Wl/7H9Q5JVy6bvwwsHzmWAB5r DUrWYOqpzt68qSUJfOkYJeoD+wsoQmrW0xWQzejIskXeC1ijnThmNG4R9n+7pnWCjzbssgpNAE4 2 X-Google-Smtp-Source: AGHT+IGDsTboqKNxDUJDeR4hk16Xy7GlNCQuMD0cgfrPKqF5Ksd8WaFSnEwi4BZPSotX81OrnJxcxw== X-Received: by 2002:a05:6808:418c:b0:3c9:691e:1e60 with SMTP id 5614622812f47-3d1a611389amr12905608b6e.31.1716914885367; Tue, 28 May 2024 09:48:05 -0700 (PDT) Received: from localhost ([2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ac17ddb6b1sm45898526d6.132.2024.05.28.09.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 09:48:04 -0700 (PDT) Date: Tue, 28 May 2024 12:47:56 -0400 From: Johannes Weiner To: Christoph Hellwig Cc: Andy Shevchenko , Baolin Wang , linux-mm@kvack.org Subject: Re: page type is 3, passed migratetype is 1 (nr=512) Message-ID: <20240528164756.GA2820@cmpxchg.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: xn6mce1ncxqymdc3o9jdcuhw64kuy4ej X-Rspamd-Queue-Id: C0557C0004 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1716914886-781629 X-HE-Meta: U2FsdGVkX19kv1a+egA3W08xySbuPzXGfm08u0M500+3OqHmU3+jMb/PVT7eAdluMZmKezXoeGGHWiXQkUzRTBMcMF/na1Dd470IhfYzHhuv1fCQySg1Kxj0f2lih6ycV/S4SlMGJkDhysOI4sxSTK6z6EErNqUW6CKgwgAydPcBsL/UIMQ4UL3axo2i168iSVlmVxlrXtHRO5oJvn1xhkxu8gcIsbztRBQ13VfoF159cuJWiJBcQlBZKkTaDm+hpWaYT97EAK1bAhBL8xbwf5TcakT5W9gMQWvlBfs7j8oIUyYgAQ6UQXv24lmERqQpdcyYjVBYeyOgQg03yCHp6JcM8VOJNvWBeMwmmu0eoc8dTi/BvLVsfbqDZFcoo+p4GbaDczbCufCnc2TeEie9CK6fIL6vwhQA3hKo6Rk7u80kizx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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: Hello, On Mon, May 27, 2024 at 06:14:12AM -0700, Christoph Hellwig wrote: > On Mon, May 27, 2024 at 01:58:25AM -0700, Christoph Hellwig wrote: > > Hi all, > > > > when running xfstests on nfs against a local server I see warnings like > > the ones above, which appear to have been added in commit > > e0932b6c1f94 (mm: page_alloc: consolidate free page accounting"). > > I've also reproduced this with xfstests on local xfs and no nfs in the > loop: > > generic/176 214s ... [ 1204.507931] run fstests generic/176 at 2024-05-27 12:52:30 > [ 1204.969286] XFS (nvme0n1): Mounting V5 Filesystem cd936307-415f-48a3-b99d-a2d52ae1f273 > [ 1204.993621] XFS (nvme0n1): Ending clean mount > [ 1205.387032] XFS (nvme1n1): Mounting V5 Filesystem ab3ee1a4-af62-4934-9a6a-6c2fde321850 > [ 1205.412322] XFS (nvme1n1): Ending clean mount > [ 1205.440388] XFS (nvme1n1): Unmounting Filesystem ab3ee1a4-af62-4934-9a6a-6c2fde321850 > [ 1205.808063] XFS (nvme1n1): Mounting V5 Filesystem 7099b02d-9c58-4d1d-be1d-2cc472d12cd9 > [ 1205.827290] XFS (nvme1n1): Ending clean mount > [ 1208.058931] ------------[ cut here ]------------ > [ 1208.059613] page type is 3, passed migratetype is 1 (nr=512) > [ 1208.060402] WARNING: CPU: 0 PID: 509870 at mm/page_alloc.c:645 expand+0x1c5/0x1f0 > [ 1208.061352] Modules linked in: i2c_i801 crc32_pclmul i2c_smbus [last unloaded: scsi_debug] > [ 1208.062344] CPU: 0 PID: 509870 Comm: xfs_io Not tainted 6.10.0-rc1+ #2437 > [ 1208.063150] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Thanks for the report. Could you please send me your .config? I'll try to reproduce it locally. > [ 1208.064204] RIP: 0010:expand+0x1c5/0x1f0 > [ 1208.064625] Code: 05 16 70 bf 02 01 e8 ca fc ff ff 8b 54 24 34 44 89 e1 48 c7 c7 80 a2 28 83 48 89 c6 b8 01 00 3 > [ 1208.066555] RSP: 0018:ffffc90003b2b968 EFLAGS: 00010082 > [ 1208.067111] RAX: 0000000000000000 RBX: ffffffff83fa9480 RCX: 0000000000000000 > [ 1208.067872] RDX: 0000000000000005 RSI: 0000000000000027 RDI: 00000000ffffffff > [ 1208.068629] RBP: 00000000001f2600 R08: 00000000fffeffff R09: 0000000000000001 > [ 1208.069336] R10: 0000000000000000 R11: ffffffff83676200 R12: 0000000000000009 > [ 1208.070038] R13: 0000000000000200 R14: 0000000000000001 R15: ffffea0007c98000 > [ 1208.070750] FS: 00007f72ca3d5780(0000) GS:ffff8881f9c00000(0000) knlGS:0000000000000000 > [ 1208.071552] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 1208.072121] CR2: 00007f72ca1fff38 CR3: 00000001aa0c6002 CR4: 0000000000770ef0 > [ 1208.072829] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 1208.073527] DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400 > [ 1208.074225] PKRU: 55555554 > [ 1208.074507] Call Trace: > [ 1208.074758] > [ 1208.074977] ? __warn+0x7b/0x120 > [ 1208.075308] ? expand+0x1c5/0x1f0 > [ 1208.075652] ? report_bug+0x191/0x1c0 > [ 1208.076043] ? handle_bug+0x3c/0x80 > [ 1208.076400] ? exc_invalid_op+0x17/0x70 > [ 1208.076782] ? asm_exc_invalid_op+0x1a/0x20 > [ 1208.077203] ? expand+0x1c5/0x1f0 > [ 1208.077543] ? expand+0x1c5/0x1f0 > [ 1208.077878] __rmqueue_pcplist+0x3a9/0x730 Ok so the allocator is taking a larger buddy off the freelist to satisfy a smaller request, then puts the remainder back on the list. There is no warning from the del_page_from_free_list(), so the buddy type and the type of the list it was taken from are coherent. The warning happens when it expands the remainder of the buddy and finds the tail block to be of a different type. Specifically, it takes a movable buddy (type 1) off the movable list, but finds a tail block of it marked highatomic (type 3). I don't see how we could have merged those during freeing, because the highatomic buddy would have failed migratetype_is_mergeable(). Ah, but there DOES seem to be an issue with how we reserve highatomics: reserving and unreserving happens one pageblock at a time, but MAX_ORDER is usually bigger. If we rmqueue() an order-10 request, reserve_highatomic_block() will only convert the first order-9 block in it; the tail will remain the original type, which will produce a buddy of mixed type blocks upon freeing. This doesn't fully explain the warning here. We'd expect to see it the other way round - passing an assumed type of 3 (HIGHATOMIC) for the remainder that is actually 1 (MOVABLE). But the pageblock-based reservations look fishy. I'll cook up a patch to make this range-based. It might just fix it in a way I'm not seeing just yet. > [ 1208.078285] get_page_from_freelist+0x7a0/0xf00 > [ 1208.078745] __alloc_pages_noprof+0x153/0x2e0 > [ 1208.079181] __folio_alloc_noprof+0x10/0xa0 > [ 1208.079603] __filemap_get_folio+0x16b/0x370 > [ 1208.080030] iomap_write_begin+0x496/0x680 > [ 1208.080441] iomap_file_buffered_write+0x17f/0x440 > [ 1208.080916] xfs_file_buffered_write+0x7e/0x2a0 > [ 1208.081374] vfs_write+0x262/0x440 > [ 1208.081717] __x64_sys_pwrite64+0x8f/0xc0 > [ 1208.082112] do_syscall_64+0x4f/0x120 > [ 1208.082487] entry_SYSCALL_64_after_hwframe+0x76/0x7e > [ 1208.082982] RIP: 0033:0x7f72ca4ce2b7 > [ 1208.083350] Code: 08 89 3c 24 48 89 4c 24 18 e8 15 f4 f8 ff 4c 8b 54 24 18 48 8b 54 24 10 41 89 c0 48 8b 74 24 b > [ 1208.085126] RSP: 002b:00007ffe56d1a930 EFLAGS: 00000293 ORIG_RAX: 0000000000000012 > [ 1208.085867] RAX: ffffffffffffffda RBX: 0000000154400000 RCX: 00007f72ca4ce2b7 > [ 1208.086560] RDX: 0000000000400000 RSI: 00007f72c9401000 RDI: 0000000000000003 > [ 1208.087248] RBP: 0000000154400000 R08: 0000000000000000 R09: 00007ffe56d1a9d0 > [ 1208.087946] R10: 0000000154400000 R11: 0000000000000293 R12: 00000000ffffffff > [ 1208.088639] R13: 00000000abc00000 R14: 0000000000000000 R15: 0000000000000551 > [ 1208.089340] > [ 1208.089565] ---[ end trace 0000000000000000 ]---