From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier Subject: Re: [RFC PATCH] discarding swap Date: Fri, 12 Sep 2008 17:50:39 +0100 Message-ID: <20080912165038.GA12849@shareable.org> References: <20080910173518.GD20055@kernel.dk> <1221082117.13621.25.camel@macbook.infradead.org> <1221228567.3919.35.camel@macbook.infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Woodhouse , Jens Axboe , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org To: Hugh Dickins Return-path: Received: from mail2.shareable.org ([80.68.89.115]:48825 "EHLO mail2.shareable.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752685AbYILQuv (ORCPT ); Fri, 12 Sep 2008 12:50:51 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hugh Dickins wrote: > > Does swap do that, when a page on the disk is deallocated and then used > > for something else? > > Yes, that's managed through the PageWriteback flag: there are various > places where we'd like to free up swap, but cannot do so because it's > still attached to a cached page with PageWriteback set; in which case > its freeing has to be left until vmscan.c finds PageWriteback cleared, > then removes page from swapcache and frees the swap. Here's an idea which is prompted by DISCARD: One thing the request layer doesn't do is cancellations. But if it did: If you schedule some swap to be written, then later it is no longer required before the WRITE has completed (e.g. process exits), on a busy system would it be worth _cancelling_ the WRITE while it's still in the request queue? This is quite similar to DISCARDing, but internal to the kernel. (Many userspace AIO interfaces do have cancellations, perhaps this is why). -- Jamie