This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: mlock in cache
- From: Andrew Haley <aph at redhat dot com>
- To: Christos <xristos dot tsop at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 02 Aug 2013 15:27:42 +0100
- Subject: Re: mlock in cache
- References: <51FBBE65 dot 2000406 at gmail dot com>
On 08/02/2013 03:12 PM, Christos wrote:
> Hi everyone,
>
> I am developing a program in C and I want to lock some memory pages in
> cache, particularly in the core specific level (i.e. level 1). As far as
> I know the C libraries do not provide an interface to do that so I guess
> that there must be some particular directives in gcc to do so.
__builtin_prefetch() is what you need. However, there's no way you'll be
able to lock anything in L1: it'll be evicted very shortly afterwards.
Andrew.