Reputation: 4374
I like to know how linux function prefetch works
It is defined as
#ifndef ARCH_HAS_PREFETCH
#define prefetch(x) __builtin_prefetch(x)
#endif
so in drivers this can be found
rx_buf = page_address(tp->Rx_databuff[entry]);//Rx_databuff[] are Page type array
dma_sync_single_for_cpu(d, addr, pkt_size, DMA_FROM_DEVICE);
prefetch(rx_buf);
skb_copy_to_linear_data(skb, rx_buf, pkt_size);
So rtl 8139 device has 256 Rx descriptors. and addr parameter to dma_sync_single_for_cpu is I think enables reading from device and save the data in some temporary memory(what is this memory area?) and so prefetch
I think is just reading that memory area and populating the rx_buf from that memory area.
I wish I could see __builtin_prefetch(x)
defination but I could not find it so what's going on with prefetch call can anyone please tell me this
Upvotes: 0
Views: 101