Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp520408lqs; Thu, 13 Jun 2024 18:33:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzdbFUjTloqER/3trhvaGGfWEyLbzdfE9LFfUx71NZAXAaTs6GV71W24s0FMWagOYkIzAumoyByxWPJAFkQInN8166LTeVV/cPx+8h4A== X-Google-Smtp-Source: AGHT+IEMZwcNdJuo79DrpwXbln7u9uKdMr8vDNw3VYq29gtOCV9u4ftTx8kHpNepp6OCtFRsMsrH X-Received: by 2002:a17:90a:dc0a:b0:2c4:e281:595c with SMTP id 98e67ed59e1d1-2c4e2815cfbmr472394a91.35.1718328785471; Thu, 13 Jun 2024 18:33:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718328785; cv=pass; d=google.com; s=arc-20160816; b=SqQTZzOQKz915xxNRd0SW6DDR1gwxzN98Iph70U/K37bPoDktJdVns6nM9LBkv1ubM E2ULJHW3Ph+a4g2wdr5IEm8ioRWs9hJ8t89KFITlEgetHOtQj8SE24ESUE+PYmeMUu6h nBZVoKe5xg5f9BmhrbJ14hqrYOjZK0j8vuYNPude69at9tjl7iR/wzS9iLbW8NpU515w lWyGWJek8IpmbFKCQPFHbqz4LnExMY4y9rSWPo6lgmyKUYr01rjw5JmhDrN3eXCSVdW1 O+k3oUf2AVLHFZFdmHM3KNj/M1fL6809fVw3aL8iY0LToVg/n9QzFMmTwggIaF+5Zr3U sdfQ== 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:from:date:dkim-signature; bh=MomHJJ0WTXAcFGOMzH8XSlE6O618dhh1qz/zUs8NtfM=; fh=besyGd/6z4JAH8oyG4EhmIEPGojuJBME3jAcHet8ntY=; b=rb2pz2KgVGRfxqHCoTqWhwbDR+XuUuJF55SYJXsXwNoPzvhbcNTwrrcv6FYI8enwuU zH3/NrqezCqIW87WtsuvzRCGTzB2yIzkXVT68r/JNZlQN3grciD/7eMg4PBUwwr/6kn5 kevRthSyHqPHR0H2dIxa6QOaLH9L355lQECs5Y6a82s6qxRIWUh604PGBtjo+mxHepGw 7xWqXyHQv9iIAotFDmUjHFpIldmI0PiGIaBI27UyMtLbim1nCOSQcYR78QGj5NZ4VaSO K8Gh0VjlodTMCTeEQwSgovV34/ohfDZq+/FuDd5sxWtQ+h8vAwyeVCBd7zaac+uxcPlX 3Dgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V856VLXp; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-214183-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 98e67ed59e1d1-2c4a76ef143si4692026a91.160.2024.06.13.18.33.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 18:33:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214183-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=@redhat.com header.s=mimecast20190719 header.b=V856VLXp; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-214183-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214183-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0051F28436E for ; Fri, 14 Jun 2024 01:33:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E761B158D92; Fri, 14 Jun 2024 01:32:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V856VLXp" 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 586B42F44 for ; Fri, 14 Jun 2024 01:32:56 +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=1718328779; cv=none; b=q38y+l2BgolFL8y2pKQD6O+K9f4r390Cge6hWCWRalwzGUmKfKaLDuoGKSW+Gz/RCeLd76wqcWqWcy+yofizk+raeMOCPnHa6Lmxwn05uRugiFWLY+lMA4MrV18iuXS3A4HxC6zcKGwoFFqHmtNF6Lct7jF8vJH2I1x5M4Gk3H4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718328779; c=relaxed/simple; bh=Fq67c7NLEOa5qBfZ6f3hPMTOPg+FlCpN87WN/bAjhW0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UCJiVS4eV0MvLIzxyCsM1LTfgY9Qo0Y+uDKhiaeQgRVGdcPcvA9Ji1tUQJzWeTQJemv7gK0HTClrr9r9RK9oTwiVtEbPWt259BrLS68QSDmxhQYpFTS3Hphr6JM+62hPC6zXcYTRtfTDot7TvVltS6/MdOL+rthB5xiVyclwJg4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=V856VLXp; arc=none smtp.client-ip=170.10.129.124 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=1718328776; 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; bh=MomHJJ0WTXAcFGOMzH8XSlE6O618dhh1qz/zUs8NtfM=; b=V856VLXpXVANJf3xliZ4YJCqlfL7zizNX7kuP0sH8uNi1cxgCY5ZVLPIJ5DqoLVppeApSJ VGqpUVzhbKYQiHQF8pe2dc8Ess8YjRD7WLwHsJlYjysRogsORxCFCC/W9+QxKfYK1aYmtZ +8grIZx0V9wlKsoROf3912J5BQdFyXA= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-355-bUZTF0aLM8u8t2Wkb7qMSw-1; Thu, 13 Jun 2024 21:32:50 -0400 X-MC-Unique: bUZTF0aLM8u8t2Wkb7qMSw-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3A320195608C; Fri, 14 Jun 2024 01:32:48 +0000 (UTC) Received: from localhost (unknown [10.72.112.37]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2E6FC3000219; Fri, 14 Jun 2024 01:32:45 +0000 (UTC) Date: Fri, 14 Jun 2024 09:32:41 +0800 From: Baoquan He To: Uladzislau Rezki Cc: 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: X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On 06/13/24 at 01:28pm, Uladzislau Rezki wrote: > 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. Thanks for detailed explanation, got it now. It's a pity we can't unify the xa and the list into one vbq structure based on one principal. > > 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 >