From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FE5A15B971 for ; Thu, 25 Sep 2025 16:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758818940; cv=none; b=isJI1Q/+UsI/y1djwzo9FNIkMzty2ksoGx+/89U/aE3PsISWZ8cuTiM1OKzbnAyfag07MnR/KgXVTA8/Dm+hV/t7ppwJHMkIuKWREhm3rWNRW35eRqswhn+TljrgFcxy+bCbierVN8PiGEkHTxtm7GlVv+fZzdPM6MCb9GjO/6E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758818940; c=relaxed/simple; bh=7AvOMpZGEPY459IpfqKAhUmTSBixPU2Xq53t7ly/Hqo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ui6ZIq8kqx53h4M14W5BjP1HDbplwl7cZx1+PyIW3f47iAVhXqajUvF1Qf5roPomOzNIXpxTzsLKHpvmaA/3hgmJ2KGnQE0eDMKsF3dm55+qWSRQ3IbFauLj9IG2AabqT72XEdolOzUGjiUHKMNqx9evwcdgHc9Kf9d4FOJbx8I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=f82ENUAB; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="f82ENUAB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1758818937; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=MjSvoYHIH2UpZoiBo+l7+GcLMTbURxxIhZVNZignwuw=; b=f82ENUAB4pYSD6VRqWvvWQ9Kq5IL4ApGodcpuw5r3runpudV7n1KMPr5/iT/cHxNE/l0Dw Cxhm3r4n8KeiymayY0VoC5K6TtHrtzF4/RRQFGJV44LmI4Ei8cW4w8ohZc9f0gXVwnCvVs 6DV3D1I2OscyxUSgpcEFwUB3PYp7fug= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-543-c3_UDpGUPsm8G0ASOve_Ig-1; Thu, 25 Sep 2025 12:48:55 -0400 X-MC-Unique: c3_UDpGUPsm8G0ASOve_Ig-1 X-Mimecast-MFC-AGG-ID: c3_UDpGUPsm8G0ASOve_Ig_1758818934 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-45f28552927so8944725e9.2 for ; Thu, 25 Sep 2025 09:48:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758818934; x=1759423734; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MjSvoYHIH2UpZoiBo+l7+GcLMTbURxxIhZVNZignwuw=; b=ogZzq5Kq0LIs2vTT/agO+iwdKbsOPi7EMmVUcCyo8/3JNZ9FbA2y5UxwE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05:600c:3b9e:b0:45f:2f0f:6649 with SMTP id 5b1f17b1804b1-46e329d474fmr59697455e9.8.1758818934311; Thu, 25 Sep 2025 09:48:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGn7Q4TLnsyQFemXW3TSRUkmiBvcmsqkTzlgD8VuFDl1YltrZigpOKq6nqZMBI5FA7WyVb9NQ== X-Received: by 2002:a05:600c:3b9e:b0:45f:2f0f:6649 with SMTP id 5b1f17b1804b1-46e329d474fmr59697125e9.8.1758818933864; Thu, 25 Sep 2025 09:48:53 -0700 (PDT) Received: from ?IPV6:2003:d8:2f3f:f800:c101:5c9f:3bc9:3d08? (p200300d82f3ff800c1015c9f3bc93d08.dip0.t-ipconnect.de. [2003:d8:2f3f:f800:c101:5c9f:3bc9:3d08]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46e2ab62233sm84331395e9.21.2025.09.25.09.48.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Sep 2025 09:48:53 -0700 (PDT) Message-ID: Date: Thu, 25 Sep 2025 18:48:52 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [syzbot] [mm?] WARNING in memory_failure To: Yang Shi , Zi Yan Cc: "Pankaj Raghav (Samsung)" , Luis Chamberlain , syzbot , akpm@linux-foundation.org, linmiaohe@huawei.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, nao.horiguchi@gmail.com, syzkaller-bugs@googlegroups.com References: <68d2c943.a70a0220.1b52b.02b3.GAE@google.com> <70522abd-c03a-43a9-a882-76f59f33404d@redhat.com> <80D4F8CE-FCFF-44F9-8846-6098FAC76082@nvidia.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiC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NsfKou3v+jP/l14a7DGBvrmlYjO 59o3t6inu6H7pt7OL6u6BQj7DoMAEQEAAcLBfAQYAQgAJgIbDBYhBBvZyq1zXEw6Rg38yk3e EPcA/4NaBQJonNqrBQkmWAihAAoJEE3eEPcA/4NaKtMQALAJ8PzprBEXbXcEXwDKQu+P/vts IfUb1UNMfMV76BicGa5NCZnJNQASDP/+bFg6O3gx5NbhHHPeaWz/VxlOmYHokHodOvtL0WCC 8A5PEP8tOk6029Z+J+xUcMrJClNVFpzVvOpb1lCbhjwAV465Hy+NUSbbUiRxdzNQtLtgZzOV Zw7jxUCs4UUZLQTCuBpFgb15bBxYZ/BL9MbzxPxvfUQIPbnzQMcqtpUs21CMK2PdfCh5c4gS sDci6D5/ZIBw94UQWmGpM/O1ilGXde2ZzzGYl64glmccD8e87OnEgKnH3FbnJnT4iJchtSvx yJNi1+t0+qDti4m88+/9IuPqCKb6Stl+s2dnLtJNrjXBGJtsQG/sRpqsJz5x1/2nPJSRMsx9 5YfqbdrJSOFXDzZ8/r82HgQEtUvlSXNaXCa95ez0UkOG7+bDm2b3s0XahBQeLVCH0mw3RAQg r7xDAYKIrAwfHHmMTnBQDPJwVqxJjVNr7yBic4yfzVWGCGNE4DnOW0vcIeoyhy9vnIa3w1uZ 3iyY2Nsd7JxfKu1PRhCGwXzRw5TlfEsoRI7V9A8isUCoqE2Dzh3FvYHVeX4Us+bRL/oqareJ CIFqgYMyvHj7Q06kTKmauOe4Nf0l0qEkIuIzfoLJ3qr5UyXc2hLtWyT9Ir+lYlX9efqh7mOY qIws/H2t In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 25.09.25 18:23, Yang Shi wrote: > On Thu, Sep 25, 2025 at 7:45 AM Zi Yan wrote: >> >> On 25 Sep 2025, at 8:02, Pankaj Raghav (Samsung) wrote: >> >>>>>> >>>>>> We might just need (a), since there is no caller of (b) in kernel, except >>>>>> split_folio_to_order() is used for testing. There might be future uses >>>>>> when kernel wants to convert from THP to mTHP, but it seems that we are >>>>>> not there yet. >>>>>> >>>>> >>>>> Even better, then maybe selected interfaces could just fail if the min-order contradicts with the request to split to a non-larger (order-0) folio. >>>> >>>> Yep. Let’s hear what Luis and Pankaj will say about this. >>>> >>>>> >>>>>> >>>>>> >>>>>> +Luis and Pankaj for their opinions on how LBS is going to use split folio >>>>>> to any order. >>>>>> >>>>>> Hi Luis and Pankaj, >>>>>> >>>>>> It seems that bumping split folio order from 0 to mapping_min_folio_order() >>>>>> instead of simply failing the split folio call gives surprises to some >>>>>> callers and causes issues like the one reported by this email. I cannot think >>>>>> of any situation where failing a folio split does not work. If LBS code >>>>>> wants to split, it should supply mapping_min_folio_order(), right? Does >>>>>> such caller exist? >>>>>> >>> >>> I am not aware of any place in the LBS path where we supply the >>> min_order. truncate_inode_partial_folio() calls try_folio_split(), which >>> takes care of splitting in min_order chunks. So we embedded the >>> min_order in the MM functions that performs the split instead of the >>> caller passing the min_order. Probably, that is why this problem is >>> being exposed now where people are surprised by seeing a large folio >>> even though they asked to split folios to order-0. >>> >>> As you concluded, we will not be breaking anything wrt LBS as we >>> just refuse to split if it doesn't match the min_order. The only issue I >>> see is we might be exacerbating ENOMEM errors as we are not splitting as >>> many folios with this change. But the solution for that is simple, add >>> more RAM to the system ;) >>> >>> Just for clarity, are we talking about changing the behaviour just the >>> try_to_split_thp_page() function or all the split functions in huge_mm.h? >> >> I want to change all the split functions in huge_mm.h and provide >> mapping_min_folio_order() to try_folio_split() in truncate_inode_partial_folio(). >> >> Something like below: >> >> 1. no split function will change the given order; >> 2. __folio_split() will no longer give VM_WARN_ONCE when provided new_order >> is smaller than mapping_min_folio_order(). >> >> In this way, for an LBS folio that cannot be split to order 0, split >> functions will return -EINVAL to tell caller that the folio cannot >> be split. The caller is supposed to handle the split failure. > > Other than making folio split more reliable, it seems like to me this > bug report shows memory failure doesn't handle LBS folio properly. For > example, if the block size <= order-0 page size (this should be always > true before LBS), memory failure should expect the large folio is > split to order-0, then the poisoned order-0 page should be discarded > if it is not dirty. The later access to the block will trigger a major > fault. Agreed that larger-folio support would be nice in memory-failure code, but I recall some other areas we recently touched that are rather hairy. (something around unmap_poisoned_folio()). The BUG at hand is that we changed splitting semantics without taking care of the actual users. -- Cheers David / dhildenb