Messages in this thread | | | Date | Thu, 11 Aug 2022 09:50:46 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH 2/3] habanalabs: trace MMU map/unmap page |
| |
On Thu, 11 Aug 2022 14:39:52 +0300 Oded Gabbay <ogabbay@kernel.org> wrote:
> @@ -259,7 +261,12 @@ int hl_mmu_unmap_page(struct hl_ctx *ctx, u64 virt_addr, u32 page_size, bool flu > if (flush_pte) > mmu_funcs->flush(ctx); > > - return rc; > + if (rc) > + return rc;
If you want to avoid the condition if tracing is disabled (for a micro-optimization) you can instead do:
if (trace_habanalabs_mmu_unmap_enabled() && !rc) trace_habanalabs_mmu_unmap(hdev->dev, virt_addr, 0, page_size, flush_pte);
return rc;
This way the above trace_habanalabs_mmu_unmap_enabled() is a static_branch, and will become a nop falling into the "return rc", and when the tracepoint is enabled, it will jump to a compare of "!rc".
-- Steve
> + > + trace_habanalabs_mmu_unmap(hdev->dev, virt_addr, 0, page_size, flush_pte); > + > + return 0; > } >
| |