From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: Why do flush page cache twice when change TT's cache attribute Date: Tue, 20 Mar 2012 11:33:39 -0400 Message-ID: <20120320153339.GB29554@phenom.dumpdata.com> References: <1332177736.2986.3.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by gabe.freedesktop.org (Postfix) with ESMTP id 984849F054 for ; Tue, 20 Mar 2012 08:37:55 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Scott Fang Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Tue, Mar 20, 2012 at 10:15:02AM +0800, Scott Fang wrote: > Can I do the optimization like: > > if (ttm->caching_state == tt_cached) > - drm_clflush_pages(ttm->pages, ttm->num_pages); > + for (i = 0; i < ttm->num_pages; ++i) > + if (PageHighMem(ttm->pages[i])) > + drm_clflush_pages(&ttm->pages[i], 1); > > only do flush cache when high memory and leave the linear memory flush in > function set_memory_uc/wc? So what are you trying to solve? I mean one way to fix this is to do: > > 2012/3/20 Jerome Glisse > > > On Mon, 2012-03-19 at 23:11 +0800, Scott Fang wrote: > > > In function ttm_tt_set_caching > > > ,,,,,,, > > > > > > if (ttm->caching_state == tt_cached) > > > drm_clflush_pages(ttm->pages, ttm->num_pages); goto out; > > > > > > for (i = 0; i < ttm->num_pages; ++i) { > > > cur_page = ttm->pages[i]; > > > if (likely(cur_page != NULL)) { > > > ret = ttm_tt_set_page_caching(cur_page, > > > ttm->caching_state, > > > c_state); > > > if (unlikely(ret != 0)) > > > goto out_err; > > > } > > > } > > out: > > > ttm->caching_state = c_state; > > > > > > return 0; Is the problem with calling page change twice making the machine slow?