Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp75045lqs; Thu, 13 Jun 2024 04:28:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUggKzUK2Fg3fa878GP81l+YMsj1NhMgXBMjm2hTRO3764JErT5nBVr6LSxJtiQchz4Q/jJ31zO6NJfjmfMD+FFgn08ZTtrc0iT4+Vixg== X-Google-Smtp-Source: AGHT+IHNcYG2p2mTzxhaMnFlspTIupReKs20E8cmpaTZ4iobREbMdvXkStEJcqdJMPZON9/WHx5k X-Received: by 2002:a05:6870:2214:b0:23f:eea9:ae74 with SMTP id 586e51a60fabf-25514e34abamr4631845fac.46.1718278096064; Thu, 13 Jun 2024 04:28:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718278096; cv=pass; d=google.com; s=arc-20160816; b=03aU5CY0bZaO9b+2YQLwKIxE7IrCL1xjJAohgSBphN+VghftEF3+ayvhBAiegpP+jE vJCJFbXw4u2Kv/pyaLKjoKnCJVllkjVf/QCETnvyCtCHGQE/QGvJ+boQNomBPmStFgCH uuZic/S7Hdr85xHHiaXc6pVNNFDBiITUF9NKUCFganu9h6uoiF5qverSUlAfUrJ5jVOV NyJbKkUs+WjW9iymxN163I6Srz9hvjNPocd7uUytah8oMnyhoJxFGm0Ao7Wofybjanl7 tB44V9SEZ2d/LJIFHu/5AsLpAaBR7qvoF7H23Pm49/B2jQPTPbh350q0hLEcV72B9+E8 Oo1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:date:from:dkim-signature; bh=RZdlCyDwmh1iqITvyeSYDfgDTIDdV6MRnysRaws4TrY=; fh=5ghcKcRyxLHe1l8WXJT5cd/Q1ZmSYlHrRk4GPX35WYo=; b=GW5LNkj2im9HSRsEo16m4KmOrsySYUw6VvrGtcAQxWj+KB4/V7B+Yc+Z5U6QL5+DG0 TtrLPZX7j8mJOP5VsHJa5PAoNX4vOkWaCv/7qRokCp7u/M6Tj2KRi3yMap2T0MURBifk RnyGzYPciyq759U2TU9YuW0YRARnFSrwm/yUEQps5GE71WnFbzFxcHeAkPTtUrD5XiYP 6A2q6Kop+G8adekdtDKzM9n4PyKxTPHvkaM6HqI1GigjP+TzTPivZ3Fa7Hqg+PL91IZJ caNPGxOvJE41lkLNr69+Ko0a8phgHVCr2sQ5ruryKC8eDmO5SIeWfI2KZBBIIqeu6lSO JAXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Xhu8OZoS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-213093-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213093-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fee60114c0si1141127a12.780.2024.06.13.04.28.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 04:28:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213093-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Xhu8OZoS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-213093-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213093-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9FA7E282A88 for ; Thu, 13 Jun 2024 11:28:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98868142911; Thu, 13 Jun 2024 11:28:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Xhu8OZoS" Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21279605C6; Thu, 13 Jun 2024 11:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718278087; cv=none; b=E6NOdr8CY3PpQ4ps/HZ52C3Snw+YU0SBU4m1cr7jd/6Xdwc8+1+7IVE0dqDOgxqfMcqsqmZqBLJzE1qlL/O/sIGksV0jHGIVAcAouBc4mzlYVSQbeNMOKAAjLsdVzJZu+xRfVG5mNpT0p/JnfEuq9XFDtLvPCSfGdpWn4KRw1jg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718278087; c=relaxed/simple; bh=xXc6y8gMVk1CtBLWX7VAQjfxosu5Yp6VJwUSaAut9Y4=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=k4JfpSAcXeuN8Oiuo7knMPTz1oqnZpHHO/MrLu4tGFYeJdwQsY8RlIQHvqwIXt9mD/+nwY/qD1nU7x5DrmSwDP8eG1zE+d8/tuToQpndasYVWprrA16xMRGo+6pbFVcLvjNIsvyMY0rxe3HNe5qJdW646mMgY6GLfRbqa9qOE2E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Xhu8OZoS; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2e95a75a90eso8597931fa.2; Thu, 13 Jun 2024 04:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718278084; x=1718882884; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=RZdlCyDwmh1iqITvyeSYDfgDTIDdV6MRnysRaws4TrY=; b=Xhu8OZoSLdMc48QP8yiXrrMFNnQ3MAoEOgA4Z36yRhf3UeuB3i5Zwx3eo3RMtNw29B 5w0tYCmomzrCyqHVNE6ZkHJz01wz3rwuA/9qpvFBLPuN2jcl/ppjy7CBKqTi4BoBKRXe HI2P+lqn8J/e07S2S0EmhmOulL/jVKvn8bjGjywnEXgluqlwoOfAWfqS7qB2QmCfmfrF 5x/9rl7T+pWvgbdGC2OxXuHbBQk78kcDOllre1FJdHAYRQ60irHOnI8KmohwdWHTDrXt GBgIeIKoa5OeZ69uKEQ+8sJ60vaAcmJO2LGHLnTWAe373MzHm09o5EvdvzwFbq0dgyJg 4iKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718278084; x=1718882884; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RZdlCyDwmh1iqITvyeSYDfgDTIDdV6MRnysRaws4TrY=; b=VyuTqRGhAoBHZWvoZVumV9x74HQilWSvO9QABA4w0DRYVrVCT6nku0lN5U2T1nV26D 5eOmsFgi1mOMbB3egCHz4EjVyEGwjHt47ivGFuRyUN+s304DBAf1lBubwalsTrYN6LO9 VViqYv9LMIQt0dIP2dSvNnGVOWI1HO3qWI34orUzvoZvmcHLZZRJwjqo9sAaaOCjetJm cxIXYhb2IFK9n1wRMpPbBQOseXBWkijtIEPLdRS3eyWLsun4rp2zt4XMX00ewlE6RHge 3Rz6MJ8UZCdY53/Q4tOzWYNCi8lBaxRBmlvlcgNMR8rgWbn9EBhZanCwaPaAygybuckW HpGA== X-Forwarded-Encrypted: i=1; AJvYcCXNyeoMSbcWTvnGo0CZpE1uwVFxMXszU24ZQJ62610++9u71zrimEUM+1F+gptvW6zuNZF/HMGVqxLmsQcZk7+W6SzaP8IP5sAF4DKueeIKl6oxa2C8vWXZlvWUDdqVGrm5SV0z X-Gm-Message-State: AOJu0YxyWI2QJXKSDgqyWy2lonUmD2PmkQqBxymMnO3ex6NPHsHDBFsx uHoKS1ToJddpQgVaqJaKswPXUaPRbXxaScUrB65eHm5IXPzOumfLgA9FidmL X-Received: by 2002:a2e:9dca:0:b0:2eb:ef0f:8699 with SMTP id 38308e7fff4ca-2ebfc8e494bmr28305131fa.26.1718278083942; Thu, 13 Jun 2024 04:28:03 -0700 (PDT) Received: from pc636 (host-90-233-218-141.mobileonline.telia.com. [90.233.218.141]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c785d4sm1812931fa.75.2024.06.13.04.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 04:28:03 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Thu, 13 Jun 2024 13:28:00 +0200 To: Baoquan He Cc: Uladzislau Rezki , Zhaoyang Huang , "zhaoyang.huang" , Andrew Morton , Christoph Hellwig , Lorenzo Stoakes , Thomas Gleixner , hailong liu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, steve.kang@unisoc.com Subject: Re: [Resend PATCHv4 1/1] mm: fix incorrect vbq reference in purge_fragmented_block Message-ID: References: <20240607023116.1720640-1-zhaoyang.huang@unisoc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Jun 13, 2024 at 04:41:34PM +0800, Baoquan He wrote: > On 06/12/24 at 01:27pm, Uladzislau Rezki wrote: > > On Wed, Jun 12, 2024 at 10:00:14AM +0800, Zhaoyang Huang wrote: > > > On Wed, Jun 12, 2024 at 2:16 AM Uladzislau Rezki wrote: > > > > > > > > > > > > > > Sorry to bother you again. Are there any other comments or new patch > > > > > on this which block some test cases of ANDROID that only accept ACKed > > > > > one on its tree. > > > > > > > > > I have just returned from vacation. Give me some time to review your > > > > patch. Meanwhile, do you have a reproducer? So i would like to see how > > > > i can trigger an issue that is in question. > > > This bug arises from an system wide android test which has been > > > reported by many vendors. Keep mount/unmount an erofs partition is > > > supposed to be a simple reproducer. IMO, the logic defect is obvious > > > enough to be found by code review. > > > > > Baoquan, any objection about this v4? > > > > Your proposal about inserting a new vmap-block based on it belongs > > to, i.e. not per-this-cpu, should fix an issue. The problem is that > > such way does __not__ pre-load a current CPU what is not good. > > With my understand, when we start handling to insert vb to vbq->xa and > vbq->free, the vmap_area allocation has been done, it doesn't impact the > CPU preloading when adding it into which CPU's vbq->free, does it? > > Not sure if I miss anything about the CPU preloading. > Like explained below in this email-thread: vb_alloc() inserts a new block _not_ on this CPU. This CPU tries to allocate one more time and its free_list is empty(because on a prev. step a block has been inserted into another CPU-block-queue), thus it allocates a new block one more time and which is inserted most likely on a next zone/CPU. And so on. See: ... rcu_read_lock(); vbq = raw_cpu_ptr(&vmap_block_queue); <- Here it is correctly accessing this CPU list_for_each_entry_rcu(vb, &vbq->free, free_list) { unsigned long pages_off; ... ... vbq = addr_to_vbq(va->va_start); <- Here we insert based on hashing, i.e. not to this CPU-block-queue spin_lock(&vbq->lock); list_add_tail_rcu(&vb->free_list, &vbq->free); spin_unlock(&vbq->lock); ... Thanks! -- Uladzislau Rezki