Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp909994pxb; Tue, 14 Sep 2021 11:19:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxodn+HfFSqTWohZYoape1tkqOE1QEhAhwtsamz9NvanI/7eJyLXBcg8ltgv2M2YNl09nre X-Received: by 2002:a5d:9693:: with SMTP id m19mr15180583ion.181.1631643557141; Tue, 14 Sep 2021 11:19:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631643557; cv=none; d=google.com; s=arc-20160816; b=CnCk0QdUX/RT5nT7v9bvVvmU7/idhq0tqNgHL79nPUr+f5d4SPEQgJ0ZQLWnYM15Mw VFDSShuKbNwLbmSpHdqpMAM50w5OYFHAZIW4Lnv/CLrxK2JWY26Q+eTc5+Q7mT0/MIyb fZ5zvvuhsqgsxRrLU7++4D0wSnjhEcBrj+H/0DTnNlmW9SvjRQPTp7UQ+K5xMFjKQgZl WBUXsLo+Xw224CxxS2AUo6A38tL2tJJ7rbdUXXkvqL2JRBPJDOL5pXLbm52iQkA28Xa5 TXeb8vgLFFZmwtSDede8R0bLUQei5sRBeNp/XAJxEK9dvlK4zVsWUFTKWL5m649VSoiN Rxvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jES37B1Gi2K2zluovx+bju9FoR0RejRId3amUw0BFp8=; b=gJt9oU5ZdbkN9md1YuLxFWLMiT58Q6U6Cp1+NNl/RwR+4yRGQlqS0C97RIyADZr2KB V+XwoYxrGfhC9Obwp+IJCe5aSWLEMUV1w0F8RQb57dw5LMAe4imhrZezTwDh1wkLbyXa qmvatR8v/ojBe3jmWi6blKMb9xe2Ydtkssw4HAfnBQJKwEfYfRJtUogMdOLEDQOETJCj O5gZjoUT6QI6aEIVFdFgNNjGQ02cxFSWAhRAU73azPcEPLgfMLdBUvfqBA2rQqRuvjaH pAtkPW1tLN00oyF3YzIG57fPHE+s4c4X75HhICXl82pbIpITmQ72ZxV+/gSLATSaLW1D XpAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ihiUe2Ja; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si8211993jat.70.2021.09.14.11.19.04; Tue, 14 Sep 2021 11:19:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ihiUe2Ja; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbhINSSF (ORCPT + 99 others); Tue, 14 Sep 2021 14:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbhINSSF (ORCPT ); Tue, 14 Sep 2021 14:18:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CE06C061574; Tue, 14 Sep 2021 11:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jES37B1Gi2K2zluovx+bju9FoR0RejRId3amUw0BFp8=; b=ihiUe2JaSHXKYPf01jQ8bREk6Z i+xVmUCWwTOYOMQspUkbFBXI6NgXSvipxPdhkN9Ouku5jZFNnVsxQzhdetV41+LbTwhMZCo86xvSQ m4RVoOAi135n5B12he1xdJjMN3acB7GnbASz3yr6i/o6sIZELsoxArmXHtZ2ciNFSXy8ZcfsDh1Cp Hh4BxRcGxRPMlqopgKnmuKgu1hrT6QH1a3HVgm39h96kRxcjGE32wDieShbJFO0+nYgDDPWYzAQsE aJTDtq5jVfNKDF1jJ78piI9Xq9nO2i5LS7yckjVe6rgq77wfOA4yCcg89YajoqcHYfyDp9vneDt1S wyGFcl1A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQCxu-00Ewgq-Vi; Tue, 14 Sep 2021 18:15:44 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 86AE43001C7; Tue, 14 Sep 2021 20:15:30 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6D2A12D378DBB; Tue, 14 Sep 2021 20:15:30 +0200 (CEST) Date: Tue, 14 Sep 2021 20:15:30 +0200 From: Peter Zijlstra To: Peter Oskolkov Cc: Jann Horn , Peter Oskolkov , Ingo Molnar , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Paul Turner , Ben Segall , Andrei Vagin , Thierry Delisle Subject: Re: [PATCH 2/4 v0.5] sched/umcg: RFC: add userspace atomic helpers Message-ID: References: <20210908184905.163787-1-posk@google.com> <20210908184905.163787-3-posk@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 14, 2021 at 08:04:55PM +0200, Peter Zijlstra wrote: > On Tue, Sep 14, 2021 at 09:29:00AM -0700, Peter Oskolkov wrote: > > In the version of the patchset that I'm preparing to send I've decided > > to punt on the issue and just ask the userspace to deal with locking > > the memory as it sees fit: mlock() is available and as far as I can > > Sadly mlock() does not imply no faults. Someone had a too literal > reading of the POSIX-RT spec (of which mlock is part) and figured that > all that was required was to keep the page in memory, not avoid faults. > > Linux has had this bahviour for ages, PREEMPT_RT has tried to change > this, but so far to no avail. At some point sys_mpin() was proposed to > meet the original POSIX-RT intent, but afaict that never actually > happened. > > In short, mlock() does not avoid minor faults, or even migration faults, > which can take a fair while to resolve. Also, even if it did, that would still not be acceptible because userspace could fail to call mlock() at which point mis-behaving userspace can deadlock the kernel, which is a no-no.