Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp750204pxb; Wed, 15 Sep 2021 12:14:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeNg0w5wVctik92c4WoV/3ChFfnp4wSAdJEwI99g2W+d68ofWW+IHZ3IPskBD9QpNL3GAp X-Received: by 2002:a92:bf01:: with SMTP id z1mr1176844ilh.155.1631733254229; Wed, 15 Sep 2021 12:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631733254; cv=none; d=google.com; s=arc-20160816; b=Azv+DvfwIPukmjf3rHvCAOUUZ1HQL3G4pZgch2yl4J3KEiPVUur0ZMs2H7Kukp18I1 BUCP4+JRjsRMwU8gYDVM/8pPva47WOXu5TIobQ2Qbm4jx7sQ3OHpjxxRHpL+waztA5Ti MotcrpL0txHaY0ZY/+3ay6ApbOqdTQtLbRz2Cp6mMak2aUS+vZzRXByBRLfBuYy5RFR1 7xlRsK9mT9E1cfnEERwPzf7R6YP963dR6is1859nz7jzTy5BXFh1Kotqvm5uJv0go7qa qhLNLCHZIYZuVgTtvk8A7ZQfbofeKXNG+mASi3DZWC0MMMNsht/3c/cQIE44snX9f7n2 U9Ig== 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=FhF5ZEUfgtRm0W8Km2DWenQUkdHHR5Cd4JcveZESDfQ=; b=trHjGeAoCkvAfJpRmacUV8IyZmR8+JYQh6qjqz8UgAXck4GlTKOCnBhn4dwMBpW8J2 rBUZoAogsUcBbDAPpA/Wn2HvNm6jGXDr9RSKFmvHD2erz9oAJA/H0ptYdrjMsmIJo3ju vnvcOdOu8NUqG7pV44FkhMtrDT1mCyElHbfZzPxRM9asMh/M1oxwxa7dWootQ8lYZFk4 +1z2Qn0XoiK/f+S7WIjjeA+1O/BxFjKHu1PANipH9rsTnBNkpxmFBMT7VgwIQdouZxN3 XjAtgL/tjAf0+996OUiLTbQLAMWjKS0luq8j74/a1piGJljxtwwgYkkS1mFro2oG7m6l VtAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=VHRzgjaQ; 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 d5si789416ilu.50.2021.09.15.12.13.48; Wed, 15 Sep 2021 12:14:14 -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=desiato.20200630 header.b=VHRzgjaQ; 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 S231414AbhIOTN4 (ORCPT + 99 others); Wed, 15 Sep 2021 15:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230230AbhIOTNz (ORCPT ); Wed, 15 Sep 2021 15:13:55 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B3DFC061574; Wed, 15 Sep 2021 12:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=FhF5ZEUfgtRm0W8Km2DWenQUkdHHR5Cd4JcveZESDfQ=; b=VHRzgjaQjFEk4mLIFinoi1c2Sk GmyHxKZnMqs6KiQsGqEHuig15rcLVGccWq4rMoxdzfv7CInmVLrKhxIjxONTQfD8Ms9uGxK2iJa9q i4chkJ9DbDCZ84rNuXjUoKAFfRt7jKmfLj4j1O/DYumJ95cAfk7d5qTQH3eWugN4/JJasXjUBGIPO 3gs3/n2LCoe2qvDlpTYNrK2/ZnEpF7cT4bFfTptjw5CtS7EFNx6RKk5xyyaYq6Lu/cN/Or1wbPdF7 Xiw7n917xLS293xtCWDVK8djzZwuLEysQti/wEj42oH3qoaAgPoZPbBQgc72Ez97tVkMIHWh3TrtJ n+I2kzZQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQaIa-003STh-1v; Wed, 15 Sep 2021 19:11:01 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id F3B419811C0; Wed, 15 Sep 2021 21:10:23 +0200 (CEST) Date: Wed, 15 Sep 2021 21:10:23 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Jann Horn , Peter Oskolkov , Peter Oskolkov , Ingo Molnar , Thomas Gleixner , Linux Kernel Mailing List , Linux API , Paul Turner , Ben Segall , Andrei Vagin , Thierry Delisle Subject: Re: [PATCH 2/4 v0.5] sched/umcg: RFC: add userspace atomic helpers Message-ID: <20210915191023.GF4323@worktop.programming.kicks-ass.net> 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 Wed, Sep 15, 2021 at 09:50:41AM -0700, Andy Lutomirski wrote: > What's the precise problem? The code would be roughly: > > if (try_pin_the_page) { > write it; > unpin; > } else { > do nothing -- .fault will fill in the correct contents. > } > > The time this takes is nondeterministic, but it's bounded and short. You can't do this from sched_submit_work(), you might already hold mmap_sem. Hence the suggestion to, for UMCG registered threads, pin the page(s) on syscall-enter and unpin on either schedule() or syscall-return.