From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759864AbZDOLjV (ORCPT ); Wed, 15 Apr 2009 07:39:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758948AbZDOLjI (ORCPT ); Wed, 15 Apr 2009 07:39:08 -0400 Received: from rv-out-0506.google.com ([209.85.198.234]:59523 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758862AbZDOLjF convert rfc822-to-8bit (ORCPT ); Wed, 15 Apr 2009 07:39:05 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=stC+FrZ0iHwmZa1wZhTKqDOS9IP+FYTkBwnUFia9aGBoH5Wl/pSqvO3yzyqHkW4H+D SrR/goAFSBKcsgvWM11rvU/y8y5evxCVdAlySMn9j5mMW6msFtWLftWQI+Wtgo1gY9/p 93wZwjRQzz0WOAwGeLEkN/e07lTFGvvm2TOHU= MIME-Version: 1.0 In-Reply-To: <20090415104615.GG9809@random.random> References: <20090414143252.GE28265@random.random> <200904150042.15653.nickpiggin@yahoo.com.au> <20090415165431.AC4C.A69D9226@jp.fujitsu.com> <20090415104615.GG9809@random.random> Date: Wed, 15 Apr 2009 20:39:04 +0900 X-Google-Sender-Auth: fa5531849fcc2cbd Message-ID: <2f11576a0904150439k6e828307ja97b6729650bcb94@mail.gmail.com> Subject: Re: [RFC][PATCH v3 1/6] mm: Don't unmap gup()ed page From: KOSAKI Motohiro To: Andrea Arcangeli Cc: Nick Piggin , LKML , Linus Torvalds , Andrew Morton , Jeff Moyer , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Hugh Dickins Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> +     if (!migration) { >> +             /* re-check */ >> +             if (PageSwapCache(page) && >> +                 page_count(page) != page_mapcount(page) + 2) { >> +                     /* We lose race against get_user_pages_fast() */ >> +                     set_pte_at(mm, address, pte, pteval); >> +                     ret = SWAP_FAIL; >> +                     goto out_unmap; >> +             } >> +     } >> +     mmu_notifier_invalidate_page(vma->vm_mm, address); > > With regard to mmu notifier, this is the opposite of the right > ordering. One mmu_notifier_invalidate_page must run _before_ the first > check. The ptep_clear_flush_notify will then stay and there's no need > of a further mmu_notifier_invalidate_page after the second check. OK. but I have one question. Can we assume mmu_notifier is only used by kvm now? if not, we need to make new notifier. From mboxrd@z Thu Jan 1 00:00:00 1970 From: KOSAKI Motohiro Subject: Re: [RFC][PATCH v3 1/6] mm: Don't unmap gup()ed page Date: Wed, 15 Apr 2009 20:39:04 +0900 Message-ID: <2f11576a0904150439k6e828307ja97b6729650bcb94@mail.gmail.com> References: <20090414143252.GE28265@random.random> <200904150042.15653.nickpiggin@yahoo.com.au> <20090415165431.AC4C.A69D9226@jp.fujitsu.com> <20090415104615.GG9809@random.random> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Nick Piggin , LKML , Linus Torvalds , Andrew Morton , Jeff Moyer , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Hugh Dickins To: Andrea Arcangeli Return-path: Received: from rv-out-0506.google.com ([209.85.198.234]:59523 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758862AbZDOLjF convert rfc822-to-8bit (ORCPT ); Wed, 15 Apr 2009 07:39:05 -0400 In-Reply-To: <20090415104615.GG9809@random.random> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: >> + =A0 =A0 if (!migration) { >> + =A0 =A0 =A0 =A0 =A0 =A0 /* re-check */ >> + =A0 =A0 =A0 =A0 =A0 =A0 if (PageSwapCache(page) && >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 page_count(page) !=3D page_mapcoun= t(page) + 2) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* We lose race against ge= t_user_pages_fast() */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 set_pte_at(mm, address, pt= e, pteval); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ret =3D SWAP_FAIL; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out_unmap; >> + =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 } >> + =A0 =A0 mmu_notifier_invalidate_page(vma->vm_mm, address); > > With regard to mmu notifier, this is the opposite of the right > ordering. One mmu_notifier_invalidate_page must run _before_ the firs= t > check. The ptep_clear_flush_notify will then stay and there's no need > of a further mmu_notifier_invalidate_page after the second check. OK. but I have one question. Can we assume mmu_notifier is only used by kvm now? if not, we need to make new notifier. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail191.messagelabs.com (mail191.messagelabs.com [216.82.242.19]) by kanga.kvack.org (Postfix) with SMTP id D9B165F0001 for ; Wed, 15 Apr 2009 07:38:29 -0400 (EDT) Received: by wf-out-1314.google.com with SMTP id 25so2722960wfa.11 for ; Wed, 15 Apr 2009 04:39:04 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20090415104615.GG9809@random.random> References: <20090414143252.GE28265@random.random> <200904150042.15653.nickpiggin@yahoo.com.au> <20090415165431.AC4C.A69D9226@jp.fujitsu.com> <20090415104615.GG9809@random.random> Date: Wed, 15 Apr 2009 20:39:04 +0900 Message-ID: <2f11576a0904150439k6e828307ja97b6729650bcb94@mail.gmail.com> Subject: Re: [RFC][PATCH v3 1/6] mm: Don't unmap gup()ed page From: KOSAKI Motohiro Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: owner-linux-mm@kvack.org To: Andrea Arcangeli Cc: Nick Piggin , LKML , Linus Torvalds , Andrew Morton , Jeff Moyer , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Hugh Dickins List-ID: >> + =A0 =A0 if (!migration) { >> + =A0 =A0 =A0 =A0 =A0 =A0 /* re-check */ >> + =A0 =A0 =A0 =A0 =A0 =A0 if (PageSwapCache(page) && >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 page_count(page) !=3D page_mapcount(pa= ge) + 2) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* We lose race against get_us= er_pages_fast() */ >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 set_pte_at(mm, address, pte, p= teval); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ret =3D SWAP_FAIL; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out_unmap; >> + =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 } >> + =A0 =A0 mmu_notifier_invalidate_page(vma->vm_mm, address); > > With regard to mmu notifier, this is the opposite of the right > ordering. One mmu_notifier_invalidate_page must run _before_ the first > check. The ptep_clear_flush_notify will then stay and there's no need > of a further mmu_notifier_invalidate_page after the second check. OK. but I have one question. Can we assume mmu_notifier is only used by kvm now? if not, we need to make new notifier. -- 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/ . Don't email: email@kvack.org