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 54B28C2BD09 for ; Tue, 9 Jul 2024 14:47:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E78F56B00B2; Tue, 9 Jul 2024 10:47:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E287F6B00B6; Tue, 9 Jul 2024 10:47:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF0846B00BA; Tue, 9 Jul 2024 10:47:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B165C6B00B2 for ; Tue, 9 Jul 2024 10:47:28 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 54BFF81996 for ; Tue, 9 Jul 2024 14:47:28 +0000 (UTC) X-FDA: 82320492576.24.F405071 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 5184BC0010 for ; Tue, 9 Jul 2024 14:47:25 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Krt9HOdh; spf=pass (imf10.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720536430; 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=pKGd0chfjLmpZEKHuB5xY93IQv++EQzmLr3G/RewAEU=; b=TWu680puwlrMYVjNYOQhAMkGd5o0l6+ZdknQTtqS7SLGKjcpEX8ZRxSbUMZ4X4rfMgeTlD I2Nhinw/TJXSy6zKkw12/Ag/xQ7j+GOJZzPqm6j+o2du1/UIYpY2TJXuC0eB6UsDxGyand jW9ECcVLgjSih/K3jLNFSJyByO364Gw= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Krt9HOdh; spf=pass (imf10.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720536430; a=rsa-sha256; cv=none; b=W7vvNY4DmK74wE8VtvF7fiV+Wu+ZpFDay5TMxvrgUxpiX6jeCNdh6yfDben6DX3MkaRK8t y2Fzv0VwIj3yEbu58mm0BuN5/umozSQcuNxFrmNxM0X7wY5bsm7pigVJh0jK251tdL04QJ FQZLfNMeBItLDVXSJlXeVJM1wZAX6cA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720536444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pKGd0chfjLmpZEKHuB5xY93IQv++EQzmLr3G/RewAEU=; b=Krt9HOdh4GWClnyIS8TeN9E3Kd4K1zcrPiKyKIihfGOQNVsbvduJ5/qOnpiQqY+w3PcOfr kqHnAmAEPNd2/NEmMCN1HEJ3qGmr+Hkq51g8YOLQkNTp1E1+MoYaxaIIm2THUHIXKOKn76 ExZTkdmbUWPbCVMoL6TwzIYfAQWZsu8= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-116-dmVX83VnPTq-BM0NnmrujA-1; Tue, 09 Jul 2024 10:47:23 -0400 X-MC-Unique: dmVX83VnPTq-BM0NnmrujA-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-447e5508682so7587111cf.0 for ; Tue, 09 Jul 2024 07:47:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720536443; x=1721141243; 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=pKGd0chfjLmpZEKHuB5xY93IQv++EQzmLr3G/RewAEU=; b=h9I74zNmfFmEcwN8uQcrnDM359kroUJJxR4Yd3v1dXvlOqVkMov1eroHPGBO0/3yRq tEiXQ8A0D99RohMHFL3JMjZRfr36m52Ya2rxHuxg9s97fOierVW+KOtIxd8Yq2DAJArk fGSxZiY+K6BG24Xksp59ZypqOMeI8aP0EKqkFEo06gTZ55zth0P8ggGPg+p3ofIBB+Xo CZmMHhCEl/K35N0K5aBC46riHPyIimaEdln4M0dNNAjNJ/PyIjJRax2C1aAN2aqnNitU KvvZ3zxgDkDYnxjMFQgbHED73cxChF5HYrmFIS/vl6N5vrC7Iae6Aqi8LObANdHRS0SY Tk1g== X-Gm-Message-State: AOJu0YzQILf56A0gGTLXcelaHGkV/e0y6IJElMDgLcwyItfwm7ebZO7b LCIlCyL4noCZ8hRWB6wotElZtVLqrE89ab9FN1p/o9stdjWSC21jWofa47iTJd3UqigThLuft3E T1JILFzePJ/mfRYU3prThINYwtwffhveBR//OOfuJybawzROX X-Received: by 2002:a05:622a:253:b0:441:37b:cd7a with SMTP id d75a77b69052e-447faa36adcmr30704751cf.3.1720536442825; Tue, 09 Jul 2024 07:47:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH33tWcjk0dogYvuKLhNnpaD7fne2RM4hSuNLuyLxvJvMIraT3PNRf7HOzpBuCDwNyB6CiAuw== X-Received: by 2002:a05:622a:253:b0:441:37b:cd7a with SMTP id d75a77b69052e-447faa36adcmr30704541cf.3.1720536442426; Tue, 09 Jul 2024 07:47:22 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-447f9b2c011sm11115401cf.19.2024.07.09.07.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 07:47:21 -0700 (PDT) Date: Tue, 9 Jul 2024 10:47:19 -0400 From: Peter Xu To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zi Yan , Yang Shi , Hugh Dickins , Baolin Wang , Huang Ying , David Hildenbrand Subject: Re: [PATCH] mm/migrate: Putback split folios when numa hint migration fails Message-ID: References: <20240708215537.2630610-1-peterx@redhat.com> <20240708160407.a0c51eb11d0403c161d27540@linux-foundation.org> MIME-Version: 1.0 In-Reply-To: <20240708160407.a0c51eb11d0403c161d27540@linux-foundation.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 5184BC0010 X-Stat-Signature: 39898rbuu1tqa4gii8uu6x4pzc6a49im X-HE-Tag: 1720536445-81244 X-HE-Meta: U2FsdGVkX1+6VvSFKHiMqwE147NEhffh34pokFow5YPTd2ho1kz71CPC7L9rjALmkMPI/SJAx6sz02Wl873MSEXX6B/dr79nEkS8PcRbEk0mJYOZzCkdh5/vFs3ihU7muBxmTBRvCgiyDAAtA0WaYexR8pFocFuoEoQUtX2DHgnNr3vIvbI1RE6iony+I7zL2hUuVF132YtLniSLPA4RXW3ZVwKCWss9dkURstyHSCyFo+Wy8BsEhiBWo0G+mYa31RcE6hVSEW/o74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XHEzQLw== 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 Mon, Jul 08, 2024 at 04:04:07PM -0700, Andrew Morton wrote: > On Mon, 8 Jul 2024 17:55:37 -0400 Peter Xu wrote: > > > This issue is not from any report yet, but by code observation only. > > > > This is yet another fix besides Hugh's patch [1] but on relevant code path, > > where eager split of folio can happen if the folio is already on deferred > > list during a folio migration. > > > > Here the issue is NUMA path (migrate_misplaced_folio()) may start to > > encounter such folio split now even with MR_NUMA_MISPLACED hint applied. > > Then when migrate_pages() didn't migrate all the folios, it's possible the > > split small folios be put onto the list instead of the original folio. > > Then putting back only the head page won't be enough. > > > > Fix it by putting back all the folios on the list. > > mm/migrate.c: In function 'migrate_misplaced_folio': > mm/migrate.c:2624:13: error: unused variable 'nr_pages' [-Werror=unused-variable] > 2624 | int nr_pages = folio_nr_pages(folio); > | ^~~~~~~~ > > Worrisome. Which kernel version was this tested against? mm-unstable (and on top of a few of my other totally irrelevant patches), and I thought it also applied to mm-stable. Totally missed this warning when still with WERROR=off locally when building against this patch, my apologies. > > > Don't need to copy stable if this can still hit 6.10.. Only smoke tested. > > Also worrisome. Are we to take an only-smoke-tested patch which > doesn't apply to mainline and which doesn't compile on mm-unstable into > mainline based on "only smoke tested"? Hmm so it doesn't apply to mainline.. For the smoke test part, I was not confident to reproduce it, and I just stumbled over it when looking at the real BUG_ON we hit. I thought it might be a good idea to send a patch before everyone forgets about it. I think it is easily overlooked probably because the issue wasn't obvious. IIUC the sympton of hitting it should be that we leak a few of those tail pages even if they're freed in the future from the mappings. I am not sure how much an issue with keep being !lru for them besides the leaked refcounts, perhaps only vmscan won't see them. After all, all these is based on the chance of hitting this case and it should be rare. I don't think I know well enough to say. Considering that nobody yelled after rc5 until now, and this is only something I observed when looking at the more severe issue Hugh fixed.. maybe we should target this for next release, then stablize it and wait for a backport to 6.10? Thanks, -- Peter Xu