All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Baolu Lu <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Ashok Raj <ashok.raj@intel.com>,
	Christoph Hellwig <hch@infradead.org>,
	Will Deacon <will@kernel.org>,
	Joao Martins <joao.m.martins@oracle.com>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCHES 1/2] iommu: Add RCU-protected page free support
Date: Wed, 15 Jun 2022 12:40:40 -0300	[thread overview]
Message-ID: <20220615154040.GA4927@nvidia.com> (raw)
In-Reply-To: <bbada5b7-737f-03dd-7d42-2ebad442a2bb@linux.intel.com>

On Fri, Jun 10, 2022 at 01:37:20PM +0800, Baolu Lu wrote:
> On 2022/6/9 20:49, Jason Gunthorpe wrote:
> > > +void iommu_free_pgtbl_pages(struct iommu_domain *domain,
> > > +			    struct list_head *pages)
> > > +{
> > > +	struct page *page, *next;
> > > +
> > > +	if (!domain->concurrent_traversal) {
> > > +		put_pages_list(pages);
> > > +		return;
> > > +	}
> > > +
> > > +	list_for_each_entry_safe(page, next, pages, lru) {
> > > +		list_del(&page->lru);
> > > +		call_rcu(&page->rcu_head, pgtble_page_free_rcu);
> > > +	}
> > It seems OK, but I wonder if there is benifit to using
> > put_pages_list() from the rcu callback
> 
> The price is that we need to allocate a "struct list_head" and free it
> in the rcu callback as well. Currently the list_head is sitting in the
> stack.

You'd have to use a different struct page layout so that the list_head
was in the struct page and didn't overlap with the rcu_head

Jason

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe via iommu <iommu@lists.linux-foundation.org>
To: Baolu Lu <baolu.lu@linux.intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	Ashok Raj <ashok.raj@intel.com>,
	Robin Murphy <robin.murphy@arm.com>,
	linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	iommu@lists.linux-foundation.org,
	Joao Martins <joao.m.martins@oracle.com>,
	Will Deacon <will@kernel.org>
Subject: Re: [RFC PATCHES 1/2] iommu: Add RCU-protected page free support
Date: Wed, 15 Jun 2022 12:40:40 -0300	[thread overview]
Message-ID: <20220615154040.GA4927@nvidia.com> (raw)
In-Reply-To: <bbada5b7-737f-03dd-7d42-2ebad442a2bb@linux.intel.com>

On Fri, Jun 10, 2022 at 01:37:20PM +0800, Baolu Lu wrote:
> On 2022/6/9 20:49, Jason Gunthorpe wrote:
> > > +void iommu_free_pgtbl_pages(struct iommu_domain *domain,
> > > +			    struct list_head *pages)
> > > +{
> > > +	struct page *page, *next;
> > > +
> > > +	if (!domain->concurrent_traversal) {
> > > +		put_pages_list(pages);
> > > +		return;
> > > +	}
> > > +
> > > +	list_for_each_entry_safe(page, next, pages, lru) {
> > > +		list_del(&page->lru);
> > > +		call_rcu(&page->rcu_head, pgtble_page_free_rcu);
> > > +	}
> > It seems OK, but I wonder if there is benifit to using
> > put_pages_list() from the rcu callback
> 
> The price is that we need to allocate a "struct list_head" and free it
> in the rcu callback as well. Currently the list_head is sitting in the
> stack.

You'd have to use a different struct page layout so that the list_head
was in the struct page and didn't overlap with the rcu_head

Jason
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2022-06-15 15:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  7:08 [RFC PATCHES 1/2] iommu: Add RCU-protected page free support Lu Baolu
2022-06-09  7:08 ` Lu Baolu
2022-06-09  7:08 ` [RFC PATCHES 2/2] iommu: Replace put_pages_list() with iommu_free_pgtbl_pages() Lu Baolu
2022-06-09  7:08   ` Lu Baolu
2022-06-09 12:49 ` [RFC PATCHES 1/2] iommu: Add RCU-protected page free support Jason Gunthorpe via iommu
2022-06-09 12:49   ` Jason Gunthorpe
2022-06-09 13:19   ` Robin Murphy
2022-06-09 13:19     ` Robin Murphy
2022-06-09 13:32     ` Jason Gunthorpe
2022-06-09 13:32       ` Jason Gunthorpe via iommu
2022-06-10  5:59       ` Baolu Lu
2022-06-10  5:59         ` Baolu Lu
2022-06-10  5:37   ` Baolu Lu
2022-06-10  5:37     ` Baolu Lu
2022-06-15 15:40     ` Jason Gunthorpe [this message]
2022-06-15 15:40       ` Jason Gunthorpe via iommu
2022-06-16  2:27       ` Baolu Lu
2022-06-16  2:27         ` Baolu Lu
2022-06-20  4:04         ` Jason Gunthorpe
2022-06-20  4:04           ` Jason Gunthorpe via iommu
2022-06-09 17:06 ` Raj, Ashok
2022-06-09 17:06   ` Raj, Ashok
2022-06-10  6:05   ` Baolu Lu
2022-06-10  6:05     ` Baolu Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220615154040.GA4927@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joao.m.martins@oracle.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.