Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755300Ab3EQSRe (ORCPT ); Fri, 17 May 2013 14:17:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54582 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754708Ab3EQSRc (ORCPT ); Fri, 17 May 2013 14:17:32 -0400 Date: Fri, 17 May 2013 11:17:08 -0700 From: Zach Brown To: Benjamin LaHaise Cc: Tang Chen , Mel Gorman , Minchan Kim , Lin Feng , akpm@linux-foundation.org, viro@zeniv.linux.org.uk, khlebnikov@openvz.org, walken@google.com, kamezawa.hiroyu@jp.fujitsu.com, riel@redhat.com, rientjes@google.com, isimatu.yasuaki@jp.fujitsu.com, wency@cn.fujitsu.com, laijs@cn.fujitsu.com, jiang.liu@huawei.com, jmoyer@redhat.com, linux-mm@kvack.org, linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Szyprowski Subject: Re: [WiP]: aio support for migrating pages (Re: [PATCH V2 1/2] mm: hotplug: implement non-movable version of get_user_pages() called get_user_pages_non_movable()) Message-ID: <20130517181708.GG318@lenny.home.zabbo.net> References: <1360056113-14294-2-git-send-email-linfeng@cn.fujitsu.com> <20130205120137.GG21389@suse.de> <20130206004234.GD11197@blaptop> <20130206095617.GN21389@suse.de> <5190AE4F.4000103@cn.fujitsu.com> <20130513091902.GP11497@suse.de> <5191B5B3.7080406@cn.fujitsu.com> <20130515132453.GB11497@suse.de> <5194748A.5070700@cn.fujitsu.com> <20130517002349.GI1008@kvack.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130517002349.GI1008@kvack.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1220 Lines: 40 > I ended up working on this a bit today, and managed to cobble together > something that somewhat works -- please see the patch below. Just some quick observations: > + ctx->ctx_file = anon_inode_getfile("[aio]", &aio_ctx_fops, ctx, O_RDWR); > + if (IS_ERR(ctx->ctx_file)) { > + ctx->ctx_file = NULL; > + return -EAGAIN; > + } It's too bad that aio contexts will now be accounted against the filp limits (get_empty_filp -> files_stat.max_files, etc). > + for (i=0; i + struct page *page; > + void *ptr; > + page = find_or_create_page(ctx->ctx_file->f_inode->i_mapping, > + i, GFP_KERNEL); > + if (!page) { > + break; > + } > + ptr = kmap(page); > + clear_page(ptr); > + kunmap(page); > + SetPageUptodate(page); > + SetPageDirty(page); > + unlock_page(page); > + } If they're GFP_KERNEL then you don't need to kmap them. But we probably want to allocate with GFP_HIGHUSER and then use clear_user_highpage() to zero them? - z -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/