From: Christoph Hellwig <hch@infradead.org>
To: Michael Kelley <mikelley@microsoft.com>
Cc: hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com,
decui@microsoft.com, tiala@microsoft.com, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] swiotlb: Track and report io_tlb_used high water mark in debugfs
Date: Tue, 28 Mar 2023 10:33:55 +0900 [thread overview]
Message-ID: <ZCJEAx/G0x6zokPF@infradead.org> (raw)
In-Reply-To: <1679766790-24629-1-git-send-email-mikelley@microsoft.com>
On Sat, Mar 25, 2023 at 10:53:10AM -0700, Michael Kelley wrote:
> @@ -659,6 +663,14 @@ static int swiotlb_do_find_slots(struct device *dev, int area_index,
> area->index = wrap_area_index(mem, index + nslots);
> area->used += nslots;
> spin_unlock_irqrestore(&area->lock, flags);
> +
> + new_used = atomic_long_add_return(nslots, &total_used);
> + old_hiwater = atomic_long_read(&used_hiwater);
> + do {
> + if (new_used <= old_hiwater)
> + break;
> + } while (!atomic_long_try_cmpxchg(&used_hiwater, &old_hiwater, new_used));
> +
> return slot_index;
Hmm, so we're right in the swiotlb hot path here and add two new global
atomics?
> static int io_tlb_used_get(void *data, u64 *val)
> {
> - *val = mem_used(&io_tlb_default_mem);
> + *val = (u64)atomic_long_read(&total_used);
> return 0;
> }
> +
> +static int io_tlb_hiwater_get(void *data, u64 *val)
> +{
> + *val = (u64)atomic_long_read(&used_hiwater);
I can't see how these casts would be needed.
next prev parent reply other threads:[~2023-03-28 1:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 17:53 Michael Kelley
2023-03-25 21:41 ` Dexuan Cui
2023-03-28 1:33 ` Christoph Hellwig [this message]
2023-03-28 13:12 ` Michael Kelley (LINUX)
2023-03-28 13:50 ` Petr Tesařík
2023-03-28 14:04 ` Petr Tesařík
2023-03-28 14:29 ` Michael Kelley (LINUX)
2023-03-28 15:07 ` Petr Tesařík
2023-03-28 15:17 ` Michael Kelley (LINUX)
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=ZCJEAx/G0x6zokPF@infradead.org \
--to=hch@infradead.org \
--cc=decui@microsoft.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mikelley@microsoft.com \
--cc=robin.murphy@arm.com \
--cc=tiala@microsoft.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®