From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Righi Subject: Re: [PATCH v5 3/3] fadvise: implement POSIX_FADV_NOREUSE Date: Mon, 13 Feb 2012 19:00:26 +0100 Message-ID: <20120213180026.GA12111@thinkpad> References: <1329006098-5454-1-git-send-email-andrea@betterlinux.com> <1329006098-5454-4-git-send-email-andrea@betterlinux.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Andrew Morton , Minchan Kim , Peter Zijlstra , Johannes Weiner , KAMEZAWA Hiroyuki , Rik van Riel , Hugh Dickins , Alexander Viro , Shaohua Li , =?iso-8859-1?Q?P=E1draig?= Brady , John Stultz , Jerry James , Julius Plenz , linux-mm , linux-fsdevel@vger.kernel.org, LKML To: KOSAKI Motohiro Return-path: Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org On Mon, Feb 13, 2012 at 11:22:26AM -0500, KOSAKI Motohiro wrote: > > @@ -1181,8 +1258,22 @@ page_ok: > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * When a sequential read accesses a p= age several times, > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * only mark it as accessed the first = time. > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 */ > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (prev_index !=3D index || offset !=3D= prev_offset) > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mark_page_accessed(page= ); > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (prev_index !=3D index || offset !=3D= prev_offset) { > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int mode; > > + > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mode =3D filemap_get_ca= che(mapping, index); > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 switch (mode) { > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case FILEMAP_CACHE_NORM= AL: > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mark_pa= ge_accessed(page); > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case FILEMAP_CACHE_ONCE= : > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mark_pa= ge_usedonce(page); > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 default: > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 WARN_ON= _ONCE(1); > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break; >=20 > Here is generic_file_read, right? Why don't you care write and page fau= lt? That's correct. I focused in my read test case and have not consider write and page fault at all yet. There's also another missing piece probably: readahead. About generic_file_read the behavior that we may want to provide looks quite clear to me. Instead, I don't know which is the best behavior for the NOREUSE writes... should we just avoid active lru list eligibility, or also drop the pages after the write if they weren't present in page cache before the write? In the former NOREUSE pages can still trash pages in the inactive lru list, in the latter writes will be slow because we need to wait for the writeback. Ideas/suggestions? About readahead pages I think we shouldn't touch anything. IIUC, when readahead pages are loaded in page cache for the first time they are added to the inactive lru list and not marked as referenced. If the readahead pages are also referenced by the application and they're inside a NOREUSE range they won't be marked as referenced and will continue to live in the inactive list (and dropped when the inactive list is shrunk). If readahead pages are not inside a NOREUSE range they will be treated as usual (marked as referenced, and moved to the active list if they're accessed more than once). Thanks, -Andrea -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter= .ca/ Don't email: email@kvack.org