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.133.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 EB2782D1F4E for ; Wed, 11 Feb 2026 20:01:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770840076; cv=none; b=Gy6VmopkRp3M6Pd3sygBCpC2Ro1s9Mruu4jLBthDW7W5NZd2ubwjEUkJ/STf+vA0eNngP9c4uriTZ/+iiJDzPJ4/7vxtlyDrQQlaE2Q0ACrrj3FQHZvcMnfN4VCnTdIlohAEc52HoJTh0SLbndQ8t8T2iVICOSjbdiFMHLZ214A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770840076; c=relaxed/simple; bh=gbzTFzf1qwsOloZwMfBXvRhqudV/HFNb7Pt4vdjNQPw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=d0gyAgNyVWS7VVDhk3xPmH7jHga8uU+/lyDWw4Fm4zpwqvHh0K9y/f6tE9Ecbirla4q04WJH5hxDDhjxBeYvChYJ538gKkNnlw+/y2KTijJ1ZTkMksO7ea+I4Vc8FxtmFEFhypr6O/VfMvtigNJrUw9NfAthK2rcIY7b7kLfWIs= 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=MDrx83Rt; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=pbxeNqX1; arc=none smtp.client-ip=170.10.133.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="MDrx83Rt"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="pbxeNqX1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770840074; 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=unlAZpu0DMR9ibJFuP5Oyxh4e+3VDJDkStDVQDwwXng=; b=MDrx83RtDHkuL4df5fdy5aAiBAMNwzxs3OdlAfoHfazW9pjKma8+lP6eNrHVgL0cVlOhh+ bp1IrG4tflYYQmKk7LEK2B3hgqzuZntuA3xepfRBHF9+Pq8PMYffRcKFBezeUksMTqhfL6 2kfm64sLI/QDhhQ7y4tR2PqySDDNoSQ= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-466-Ap1IlD8JNp2uqCMBmCiN2w-1; Wed, 11 Feb 2026 15:01:12 -0500 X-MC-Unique: Ap1IlD8JNp2uqCMBmCiN2w-1 X-Mimecast-MFC-AGG-ID: Ap1IlD8JNp2uqCMBmCiN2w_1770840071 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-894727de401so51872276d6.1 for ; Wed, 11 Feb 2026 12:01:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770840071; x=1771444871; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=unlAZpu0DMR9ibJFuP5Oyxh4e+3VDJDkStDVQDwwXng=; b=pbxeNqX1hoGg/ZAcgDD3OklffhD62DiYXOVyNCYZQdQSt8SNGdVUA1BRbRl/XYhyVL 9xwxDHB3gQZZ5aHgZbV9lvmEdzM4nvBbWYydpKIra8C2gHKKcv0mfySwNQx9KESvmRhk eeTY1a4aDv9vT6tL6aR2/tol9E/gt9uCSo4RZzN9Gru79hhBSsZ6+7vNEYRuzn8EwFu7 4i5SqQAVswR4ILyyufbq3jRxflHUj9uTe1WxgWp78AWFBeQad+fLlYEayW83iW49BlO7 Vb43GDr702qXAPENOlu+dr/0iXCOm0CWZA9c+8v9JQcQoWeVnrRDR7H2BFcHL+QURCzM BUGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770840071; x=1771444871; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=unlAZpu0DMR9ibJFuP5Oyxh4e+3VDJDkStDVQDwwXng=; b=kBCzpB7q72kV8Fa3RXkT+JKedajbMtYkAI2Z6QnCqvxffv2KNWz7yPp+clz3f1Wfgx jaB48Z2w6IWuweQifPA+IPir5OiBMUxh1c9ii5LwahyYjZV1ceEzVbPT9BVsBcLiWUhX p8exTOx4nrZRQbhmecAzij5qaHjxQeS9NiHJUA80CZLvZ9xV7Q2NRg3BtlQZ9NTkBIo7 lC7QI7coyuVsyf/oro+l6yUwdrgM44hdQj1Xtq5JpzB/tPi8ZtX9BHObniUQ0PXMiV06 2ulZQK6ooGVHniX8Lv4iMPqTPT06jWtErV/lb1sSDy2emO9SAkiGJx1Sq6cWzJ+MXdxS KADw== X-Forwarded-Encrypted: i=1; AJvYcCUxQRaXaOw7SdBvO0ojZ1V7TgJETUOij5wxe+mKgSrlUs+RXT0lRKWIJGWFUACIak/9xHw=@vger.kernel.org X-Gm-Message-State: AOJu0Yxgv5i/xfpdhRAwDEZlXzl77mSMF49Ngqp/Khiyu1uQtwenTFfo 6IIdfSw8o+aHttn3xzHLvbEW/wySrLrtFw+4qlEU9otUeCzUtu5+v2+y0tDKbo9wRCx6uU+BPvw 1s0UUQVUeO57ZhJwglkUk6KcXg5acqNQVEzjSxhNxKtF+szONiJTOpA== X-Gm-Gg: AZuq6aJ3OrXLFDsiblpwBsQZidAg+rQQAJWlTglr8mW5dpxm6reReHh7Mh1cu9b9I2k 9t8GpPCPOYi5Z1iu4UL1a940HAdzRyPobLY6C3iyMvVP1RDed33pVeU92qx/spR939sWqlE1bgc t8bYPYrBleKmFf8yd8HejLeSUYXFu8/wOQvQQn3QYOs1U4Q9UF+jddJ1iO2XHsUTanRYRz5igUq 4ufF9lqjH6ei+BYMPtY3Cdup7KXBFeTQrUxwtuufxVbohQ43NjWp5nsSvTe0EKsvGR9uSwoKLal 2S1eld4SFke0stfOm4L/UVlI8p1c6ylQRUUEwlp1NxZOoMN4NuEbGTDgc5M4RJEl46HCjm+PG7g YOcR9gI1a6/0M4peygU2RZdbD6kuOqXuYq0+Ym1EH6h70IeGjebdCiNHYtlx9ZXJAnbT5hdj/SW tOcvZbeA== X-Received: by 2002:ad4:5aa4:0:b0:894:71fe:89f4 with SMTP id 6a1803df08f44-89728d939c3mr2000416d6.11.1770840071460; Wed, 11 Feb 2026 12:01:11 -0800 (PST) X-Received: by 2002:ad4:5aa4:0:b0:894:71fe:89f4 with SMTP id 6a1803df08f44-89728d939c3mr1999556d6.11.1770840070818; Wed, 11 Feb 2026 12:01:10 -0800 (PST) Received: from x1.local (bras-vprn-aurron9134w-lp130-03-174-91-117-149.dsl.bell.ca. [174.91.117.149]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-506920071c4sm3288501cf.1.2026.02.11.12.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Feb 2026 12:01:10 -0800 (PST) Date: Wed, 11 Feb 2026 15:00:58 -0500 From: Peter Xu To: Mike Rapoport Cc: linux-mm@kvack.org, Andrea Arcangeli , Andrew Morton , Axel Rasmussen , Baolin Wang , David Hildenbrand , Hugh Dickins , James Houghton , "Liam R. Howlett" , Lorenzo Stoakes , Michal Hocko , Muchun Song , Nikita Kalyazin , Oscar Salvador , Paolo Bonzini , Sean Christopherson , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH RFC 10/17] shmem, userfaultfd: implement shmem uffd operations using vm_uffd_ops Message-ID: References: <20260127192936.1250096-1-rppt@kernel.org> <20260127192936.1250096-11-rppt@kernel.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Sun, Feb 08, 2026 at 12:35:43PM +0200, Mike Rapoport wrote: > > > +static void shmem_mfill_filemap_remove(struct folio *folio, > > > + struct vm_area_struct *vma) > > > +{ > > > + struct inode *inode = file_inode(vma->vm_file); > > > + > > > + filemap_remove_folio(folio); > > > + shmem_recalc_inode(inode, 0, 0); > > > folio_unlock(folio); > > > - folio_put(folio); > > > -out_unacct_blocks: > > > - shmem_inode_unacct_blocks(inode, 1); > > > > This looks wrong, or maybe I miss somewhere we did the unacct_blocks()? > > This is handled by shmem_recalc_inode(inode, 0, 0). IIUC shmem_recalc_inode() only does the fixup of shmem_inode_info over possiblly changing inode->i_mapping->nrpages. It's not for reverting the accounting in the failure paths here. OTOH, we still need to maintain accounting for the rest things with correctly invoke shmem_inode_unacct_blocks(). One thing we can try is testing this series against either shmem quota support (since 2023, IIUC it's relevant to "quota" mount option), or max_blocks accountings (IIUC, "size" mount option), etc. Any of those should reflect a difference if my understanding is correct. So IIUC we still need the unacct_blocks(), please kindly help double check. Thanks, -- Peter Xu