lkml.org 
[lkml]   [2022]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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;
> }
>

\
 
 \ /
  Last update: 2022-08-11 15:51    [W:1.169 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site