Can I do the optimization like:<br><br> if (ttm->caching_state == tt_cached)<br> - drm_clflush_pages(ttm->pages, ttm->num_pages);<br>+ for (i = 0; i < ttm->num_pages; ++i) <br>+ if (PageHighMem(ttm->pages[i]))<br>
+ drm_clflush_pages(&ttm->pages[i], 1);<br><br>only do flush cache when high memory and leave the linear memory flush in function set_memory_uc/wc?<br><br><div class="gmail_quote">2012/3/20 Jerome Glisse <span dir="ltr"><<a href="mailto:j.glisse@gmail.com">j.glisse@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">On Mon, 2012-03-19 at 23:11 +0800, Scott Fang wrote:<br>
> In function ttm_tt_set_caching<br>
> ,,,,,,,<br>
><br>
> if (ttm->caching_state == tt_cached)<br>
> drm_clflush_pages(ttm->pages, ttm->num_pages);<br>
><br>
> for (i = 0; i < ttm->num_pages; ++i) {<br>
> cur_page = ttm->pages[i];<br>
> if (likely(cur_page != NULL)) {<br>
> ret = ttm_tt_set_page_caching(cur_page,<br>
> ttm->caching_state,<br>
> c_state);<br>
> if (unlikely(ret != 0))<br>
> goto out_err;<br>
> }<br>
> }<br>
><br>
> ttm->caching_state = c_state;<br>
><br>
> return 0;<br>
><br>
><br>
> drm_clflush_pages flush cache one time.<br>
> then in the following function<br>
> ttm_tt_set_page_caching->set_memory_wc->change_page_attr_set: in this<br>
> function may flush page cache again.<br>
><br>
> Does the code do some abundant flush, or there is some trick to these<br>
> codes?<br>
><br>
> Thanks for the answer in advance.<br>
<br>
</div></div>Yes there might be redundant flushing.<br>
<br>
Cheers,<br>
<font color="#888888">Jerome<br>
<br>
</font></blockquote></div><br>