From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751634Ab3LKRIV (ORCPT ); Wed, 11 Dec 2013 12:08:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23923 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996Ab3LKRIU (ORCPT ); Wed, 11 Dec 2013 12:08:20 -0500 Date: Wed, 11 Dec 2013 18:08:44 +0100 From: Oleg Nesterov To: Linus Torvalds Cc: Dave Jones , Thomas Gleixner , Darren Hart , Andrea Arcangeli , Linux Kernel Mailing List , Peter Zijlstra , Mel Gorman Subject: Re: process 'stuck' at exit. Message-ID: <20131211170844.GA21700@redhat.com> References: <20131210203559.GA1209@redhat.com> <20131210204925.GB27373@redhat.com> <20131210213431.GA6342@redhat.com> <20131210214143.GG27373@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/10, Linus Torvalds wrote: > > I think what happens is: > - get_user_pages_fast(address, 1, 1, &page) fails (because it's read-only) > - get_user_pages_fast(address, 1, 0, &page) succeeds and gets a large-page > - __get_user_pages_fast(address, 1, 1, &page) fails (because it's read-only). > > so what triggers this is likely that Dave now does large-pages, and > one of them is a read-only mapping. > > So I would suggest replacing the second "1" in the > __get_user_pages_fast() call with a "!ro" instead. So how about this > second patch instead (the access_ok() move remains). I know almost nothing about THP, but why we may need write == true in this case? IOW, > - if (likely(__get_user_pages_fast(address, 1, 1, &page) == 1)) { > + if (likely(__get_user_pages_fast(address, 1, !ro, &page) == 1)) { can't if (likely(__get_user_pages_fast(address, 1, 0, &page) == 1)) { work? I have to admit, I do not understand why we can't avoid this altogether. __get_page_tail() can find the stable ->first_page, why get_futex_key() can't ? Oleg.