From patchwork Tue Sep 5 21:42:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13375095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 965CDCA100D for ; Tue, 5 Sep 2023 21:42:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC4068E000D; Tue, 5 Sep 2023 17:42:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD6068E000B; Tue, 5 Sep 2023 17:42:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B01A18E000D; Tue, 5 Sep 2023 17:42:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 977178E000B for ; Tue, 5 Sep 2023 17:42:48 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6ACC0160ABD for ; Tue, 5 Sep 2023 21:42:47 +0000 (UTC) X-FDA: 81203868774.05.BCF9E30 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 614094000C for ; Tue, 5 Sep 2023 21:42:45 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Lkvio2yb; spf=pass (imf07.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693950165; a=rsa-sha256; cv=none; b=UIp5jjQ4A8TiTsftjfjgSLpHPckUfxz5phqPCs9BbfY25heSlpb0Mh97PtlFdvVguwGMhV GLLagkdWwy/rpe5Mv7o1Z7Zu9YS6mju/uy+ItxVYRoFgeuLXfPzJBWtlxGf5mcSd0ha9hH KA8p4STanVGO3hYs7kM5LVsuDhNfWMI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Lkvio2yb; spf=pass (imf07.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693950165; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=i4qwgXUgzQeLfKMT3tv3YVc7S/hLt8ARXOPSgsfGIQ4=; b=8lUL/tZBSMISTs3X4gNLwAGvjyDPkEKjHyRjtYmdzigSppnE/ALkq1jJB1QcYonLvaEGN+ MbiKcV+fHr6Mgi3ogIn7ByvKJx2xqpoHxZn9Y+3sACv4+vk5HpUovaRMJyLSfEchBx6bIW 4ZF0ZMXasXwCFCLZN4WkEL5BjFkHBLU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693950164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i4qwgXUgzQeLfKMT3tv3YVc7S/hLt8ARXOPSgsfGIQ4=; b=Lkvio2ybCpoBmp/4VfNsaGEyf3H83DGRRbW+C5dM0mJUGf34WhOvyJ/eqmQ+VBuA0oVu8p D4hgRkIGzrsLIZ0O0O4vucc11gPHs85yQxUr0i8iszPoNGOFJyJlgvbVir30t97FpHSnYc LpkJoqACjcz9HKBr9/rmtE9IOZvtqXE= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-413-rdYBiinpNe2EEFTp6aEkkQ-1; Tue, 05 Sep 2023 17:42:43 -0400 X-MC-Unique: rdYBiinpNe2EEFTp6aEkkQ-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-63c9463c116so6468436d6.0 for ; Tue, 05 Sep 2023 14:42:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693950163; x=1694554963; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i4qwgXUgzQeLfKMT3tv3YVc7S/hLt8ARXOPSgsfGIQ4=; b=MIDVkD3K/wDnSF2TL7QhU8usd7KxVu5YAhUzCOHVNnxLx+5zgzX+nbA/aN71glDc96 3RDyuXw3ECFCiN94eFhhqASmyISOgsfvUG7HhQLaxosQqNm1yD0J4ZcNLiGCzgPIDHlj lwEHjE1GJ0U7HyV1xuDxNGaODmHVNtwUZEOEgoX8xN7bNYbJbRw+9mefkORSawhNToOa WykP9gSJEXGZ2wUeo5cJwzVr0UUkgxp4ygC/XGKTP+vAv6G7M5J5qJUhXIJLuqo6Kwcg 5qv4+WRLOVNt62fnjyOVXJkkVI4Ov3ijgIAb1NwDLYREJsXCvBYpLgMYAOgFeUfTNeGc 5Lmw== X-Gm-Message-State: AOJu0YzUdMPwc/3YYLv6vJ3F99L28lRplKC2TrHnbi1liNqPJhdoda9J UJe8ALSvVYDYgnvpcI/lcJJgNqahVUoPdMH21sw5G9ASlgmfl/Tr351W1vZauT8J92SH4l+/Dms YfdmY6gF6NP4= X-Received: by 2002:a05:6214:21e4:b0:64a:8d39:3378 with SMTP id p4-20020a05621421e400b0064a8d393378mr17304042qvj.4.1693950163015; Tue, 05 Sep 2023 14:42:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlS4tLxX3RT0SNIZn/SUsnHB3xGIbADDb9sPouLrcBV//Rq31qTbeRmNhRZtJnSN5gXEiBhA== X-Received: by 2002:a05:6214:21e4:b0:64a:8d39:3378 with SMTP id p4-20020a05621421e400b0064a8d393378mr17304030qvj.4.1693950162797; Tue, 05 Sep 2023 14:42:42 -0700 (PDT) Received: from x1n.redhat.com (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id i2-20020a37c202000000b007682af2c8aasm4396938qkm.126.2023.09.05.14.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 14:42:42 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Anish Moorthy , Axel Rasmussen , Alexander Viro , Mike Kravetz , Peter Zijlstra , Andrew Morton , Mike Rapoport , Christian Brauner , peterx@redhat.com, linux-fsdevel@vger.kernel.org, Andrea Arcangeli , Ingo Molnar , James Houghton , Nadav Amit Subject: [PATCH 4/7] fs/userfaultfd: Use exclusive waitqueue for poll() Date: Tue, 5 Sep 2023 17:42:32 -0400 Message-ID: <20230905214235.320571-5-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230905214235.320571-1-peterx@redhat.com> References: <20230905214235.320571-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 614094000C X-Stat-Signature: amr169dg7x8rcxdaxqqhkd9homr6nrpn X-Rspam-User: X-HE-Tag: 1693950165-379225 X-HE-Meta: U2FsdGVkX1+Oiu07epmP6TfLiqSX3lIQ11zHudi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B5UKuiXyU2T/Uh9otM1aQjSyW2I0cmkNG4m8f0gp7Th1x9bNArKWvH57yMXKJDih8GmE9PlU40XiDxYnZqwHuFq/J9qD2dDjBXmqLT2bq0FjA/d/E03bbHdgj4ZcFYeIyaId8Da0mz7JLkww0avP5zlmg80WQEZJmzA+GCebr/daBpET/sSDg2Up77Gawm6bxEWH0Dlzj2AXvccfreumKoAzP3DeXTH1s7WlyUgSIzsprwXgBDmDsBi+YU81PUWtyo4ngdfsHpUWOCjtB8318ZMVREVoxwbb3arXbx4ya8EvswTw3uTMQDsqOk+85nssaz3ICtPuYDemMdXPz4bBc8E+8pYcqvhaA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Userfaultfd is the kind of fd that does not need a wake all semantics when wake up. Enqueue using the new POLL_ENQUEUE_EXCLUSIVE flag. Signed-off-by: Peter Xu --- fs/userfaultfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index f7fda7d0c994..9c39adc398fc 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -994,7 +994,7 @@ static __poll_t userfaultfd_poll(struct file *file, poll_table *wait) struct userfaultfd_ctx *ctx = file->private_data; __poll_t ret; - poll_wait(file, &ctx->fd_wqh, wait); + poll_wait_exclusive(file, &ctx->fd_wqh, wait); if (!userfaultfd_is_initialized(ctx)) return EPOLLERR;