Received: by 2002:a05:7412:a9a8:b0:f9:92ae:e617 with SMTP id o40csp17193rdh; Wed, 20 Dec 2023 14:29:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfZ816IhwbeggdS0k6xGZC8VhNLQnL77DBYSmODMHMN/ge1av53QavaSUsXwfAr3W4Glmr X-Received: by 2002:a17:906:a38f:b0:a1d:4874:1ab7 with SMTP id k15-20020a170906a38f00b00a1d48741ab7mr3944171ejz.65.1703111366047; Wed, 20 Dec 2023 14:29:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703111366; cv=none; d=google.com; s=arc-20160816; b=tyhuoHxbnR/Bel5FEf6dwRsSoIAS9KKQ85ULgN3F+RWgRIjObqgC7Pbi54ecFJ71j+ fuOUHY4zZdqxyQ+sW0V6J6pJljxCpMss442PPZl/jYc0z5cM24OE4EUBAa6ZcMCKldFk m7ePRfbux0qa6v3VKTtiPHQ/3DOqgSg8wgewAzfDl1fA0sZ/M+Qwpkzqxlh0/g+SagnM 1AOexWda31hysazpHnc+/Pd/bm9WgbvjDITeOtpA+fFmP90VYxJgBj9uhIYZ86NQnjLj C2zsZRHqjRhZOZEl8P9k+KGP0VvVgiggeJKDJAAiPjThay1nmOltd+J9QJ5Lg/+mxPAU B45w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=biKuMYxWNtLoc9oN17eZQHcrTRic6oxMUpNAggHYZyE=; fh=X3xTSlSs+2LlqAixo7SNpvsrCHD5dl/78QRcg4Hub+0=; b=rjR2WigCneGU3mX9kW6kOjMqABzTgRhZ8Q8WgjzgNLMlqHgqokOisp3OTHuqBz2fVD dJTomuQEj3bFZxq2supHT3PZnGevsyXJfEiO7llkuhJpK9itfQOLScpXJmwfV3zdX3t/ l9Axq0Ey/Arzkffy172H84ptXvTng/KHX7546laNb6DR7OVTohBZHxbCCuz/x0jWlpOR aUKoIOv/q4moINaG0DCEG3As5PSA3wzkJQ4yutI1oRvn0b7ZuOdaEJEZrwW9/VGrqmRT 1U7JMYJz3Zj6LyhwMfCMfVMBHDTafTzEoyQ2zaI9g0g9zm3E42BcAgUJHqNm8HnUiOSg Oy/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eMaZ3mdq; spf=pass (google.com: domain of linux-kernel+bounces-7517-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7517-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dm16-20020a170907949000b00a2391faddf5si226895ejc.445.2023.12.20.14.29.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 14:29:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7517-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eMaZ3mdq; spf=pass (google.com: domain of linux-kernel+bounces-7517-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7517-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9D4511F23D29 for ; Wed, 20 Dec 2023 22:29:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CDEA44A9B4; Wed, 20 Dec 2023 22:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eMaZ3mdq" X-Original-To: linux-kernel@vger.kernel.org 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 6D1E6495CA for ; Wed, 20 Dec 2023 22:29:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703111354; 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=biKuMYxWNtLoc9oN17eZQHcrTRic6oxMUpNAggHYZyE=; b=eMaZ3mdqqAn8WorJVxsV6SrUJbpDBHOrKhe7Y7/caD+Ew/7fekzLNvfXWK6ZmDOIV6jJbw AYlmp8yMUNFJpbKH9ntY54v7wuckA/cUvIrlIHct2DW3e7VA7nqx5/MtxvrTgQMbyTZ9Z6 V3+q6bLdHns1+vFGte3cdFj4echRdcI= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-561-bfuLmGrwOkG4IXB-MPovBA-1; Wed, 20 Dec 2023 17:29:13 -0500 X-MC-Unique: bfuLmGrwOkG4IXB-MPovBA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40c295f59ceso6209625e9.0 for ; Wed, 20 Dec 2023 14:29:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703111351; x=1703716151; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=biKuMYxWNtLoc9oN17eZQHcrTRic6oxMUpNAggHYZyE=; b=L01O72RFNNbovgWaDX1yR1SeoT4IHP+kHjDM87gOjpX75Oax7+f/LeEvX3ko9WBne7 BphRnpNAkUchsa76D9mXNr72F1erPr6Q3Frmq556A1OLM/VyN85YKWovmV2nsqys0Efi WKW6HVLjfwel82vjQ/9RdIbWIJyrBoiwwxtXq3e8jjcUUMXmAbt2hmtJuo9KRcggOyUB 9u1Hep06MVa9kVzcwNwM48yfC9MDljAmfrhQ1bEWiTUVo7ae+d94X5n25D3OPfN6H9P6 0IdKMv6zDxIhVsm03qKm4fwQjSXzHI59oILkyNLcLh2ZttW+kVbMA0tU3fQtzqycNrNS +bzQ== X-Gm-Message-State: AOJu0YxDWq09H2pFd7Ref/4lSHpmXNfZaCAxz4UoF1xNcwmsQEM05sZX L2VFgredTW2di3LpkVU88hjLHb0QWyPBwLRi4uGP1mkrkpJ725L/uIIK38ZY5xA0NNfpvmypaAw 5pB4fzGqjZP3yUJ1llF1oL8tq X-Received: by 2002:a1c:7414:0:b0:40c:3984:4985 with SMTP id p20-20020a1c7414000000b0040c39844985mr142972wmc.79.1703111351636; Wed, 20 Dec 2023 14:29:11 -0800 (PST) X-Received: by 2002:a1c:7414:0:b0:40c:3984:4985 with SMTP id p20-20020a1c7414000000b0040c39844985mr142966wmc.79.1703111351182; Wed, 20 Dec 2023 14:29:11 -0800 (PST) Received: from ?IPV6:2003:cb:c740:9d00:be3b:a58f:4d39:51e7? (p200300cbc7409d00be3ba58f4d3951e7.dip0.t-ipconnect.de. [2003:cb:c740:9d00:be3b:a58f:4d39:51e7]) by smtp.gmail.com with ESMTPSA id u4-20020a05600c138400b0040c03c3289bsm961430wmf.37.2023.12.20.14.29.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Dec 2023 14:29:10 -0800 (PST) Message-ID: Date: Wed, 20 Dec 2023 23:29:09 +0100 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: [linux-next:master] [mm] bbcbf2a3f0: kernel_BUG_at_mm/memory.c Content-Language: en-US To: Andrew Morton , kernel test robot Cc: Matthew Wilcox , oe-lkp@lists.linux.dev, lkp@intel.com, Linux Memory Management List , linux-kernel@vger.kernel.org References: <202312192319.fa8f5709-oliver.sang@intel.com> <20231220141135.cb4241442b657104f0aeae34@linux-foundation.org> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT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y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20231220141135.cb4241442b657104f0aeae34@linux-foundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 20.12.23 23:11, Andrew Morton wrote: > On Tue, 19 Dec 2023 23:46:50 +0800 kernel test robot wrote: > >> >> >> Hello, >> >> kernel test robot noticed "kernel_BUG_at_mm/memory.c" on: >> >> commit: bbcbf2a3f05f74f9d268eab57abbdce6a65a94ad ("mm: convert ksm_might_need_to_copy() to work on folios") > > I assume this is a bisection result, so it's quite repeatable? > >> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master >> >> [test failed on linux-next/master aa4db8324c4d0e67aa4670356df4e9fae14b4d37] >> >> in testcase: vm-scalability >> version: vm-scalability-x86_64-1.0-0_20220518 >> with following parameters: >> >> runtime: 300 >> thp_enabled: always >> thp_defrag: always >> nr_task: 32 >> nr_ssd: 1 >> priority: 1 >> test: swap-w-rand >> cpufreq_governor: performance >> >> test-description: The motivation behind this suite is to exercise functions and regions of the mm/ of the Linux kernel which are of interest to us. >> test-url: https://git.kernel.org/cgit/linux/kernel/git/wfg/vm-scalability.git/ >> >> >> compiler: gcc-12 >> test machine: 128 threads 2 sockets Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz (Ice Lake) with 128G memory >> >> (please refer to attached dmesg/kmsg for entire log/backtrace) >> >> >> >> If you fix the issue in a separate patch/commit (i.e. not just a new version of >> the same patch/commit), kindly add following tags >> | Reported-by: kernel test robot >> | Closes: https://lore.kernel.org/oe-lkp/202312192319.fa8f5709-oliver.sang@intel.com >> >> >> [ 61.404380][ T5947] ------------[ cut here ]------------ >> [ 61.409984][ T5947] kernel BUG at mm/memory.c:3990! >> [ 61.415085][ T5947] invalid opcode: 0000 [#1] SMP NOPTI > > This is > > BUG_ON(folio_test_anon(folio) && PageAnonExclusive(page)); > > and I don't believe that the error path fix > (https://lkml.kernel.org/r/ZXnPtblC6A1IkyAB@casper.infradead.org) will > address this. > > Matthew, have you had a chance to consider? Isn't the page = folio_page(folio, 0); just wrong? We must not do that if the folio didn't change, otherwise we're in trouble if we had a large folio in the swapcache. Maybe something like the following? diff --git a/mm/memory.c b/mm/memory.c index d995ead7a3933..3aca5e33c6f81 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3961,7 +3961,8 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) folio = swapcache; goto out_page; } - page = folio_page(folio, 0); + if (folio != swapcache) + page = folio_page(folio, 0); /* * If we want to map a page that's in the swapcache writable, we -- Cheers, David / dhildenb