Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754135AbbEOSWN (ORCPT ); Fri, 15 May 2015 14:22:13 -0400 Received: from mail-ig0-f178.google.com ([209.85.213.178]:38512 "EHLO mail-ig0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753391AbbEOSWK (ORCPT ); Fri, 15 May 2015 14:22:10 -0400 MIME-Version: 1.0 In-Reply-To: <20150515160426.GD19097@redhat.com> References: <1431624680-20153-1-git-send-email-aarcange@redhat.com> <1431624680-20153-11-git-send-email-aarcange@redhat.com> <20150515160426.GD19097@redhat.com> Date: Fri, 15 May 2015 11:22:09 -0700 X-Google-Sender-Auth: oua39SNW56fjQmu6T0b3RaCae54 Message-ID: Subject: Re: [PATCH 10/23] userfaultfd: add new syscall to provide memory externalization From: Linus Torvalds To: Andrea Arcangeli Cc: Andrew Morton , Linux Kernel Mailing List , linux-mm , qemu-devel@nongnu.org, KVM list , Linux API , Pavel Emelyanov , Sanidhya Kashyap , zhang.zhanghailiang@huawei.com, "Kirill A. Shutemov" , Andres Lagar-Cavilla , Dave Hansen , Paolo Bonzini , Rik van Riel , Mel Gorman , Andy Lutomirski , Hugh Dickins , Peter Feiner , "Dr. David Alan Gilbert" , Johannes Weiner , "Huangpeng (Peter)" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 811 Lines: 19 On Fri, May 15, 2015 at 9:04 AM, Andrea Arcangeli wrote: > > To fix it I added this along a comment: Ok, this looks good as a explanation/fix for the races (and also as an example of my worry about waitqueue_active() use in general). However, it now makes me suspect that the optimistic "let's check if they are even active" may not be worth it any more. You're adding a "smp_mb()" in order to avoid taking the real lock. Although I guess there are two locks there (one for each wait-queue) so maybe it's worth it. Linus -- 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/