From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4E31ECAAA1 for ; Tue, 6 Sep 2022 20:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x5s6aEhJlos73+KeiZHv8ctHwkj7jLTTW0bQ19HAeK8=; b=I/xQ1zSpqqVlYQ ie04WXzT935/UwenHQTt/eT3RApKPGi8g2lTIDD0IYQIEhcQfeWkAESdZqFvA62Yvs60nkcxdLmja 9poCyw3M7cgD2UeMUbtnB5kpEaTvM6GggMqgIUPz2j45NpaWBuHbKHHnI8kfmrvpYahRVXEB5Xu4w Or8FrMNyR25d9ONOeQ4QTITUShpHTjUiMdHNB7DNd33GmMat3L+tx9gpHYWLZedc3lGM6qrqU5yHH DX1Rbus4HU4ij60z1jirlerLcR4y+V04lYtT0VKj4JVjFg43bfZ0UstE9LfHQDmbmF5UhFVuTREos C5J3GHF7IzdsHykPY07Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVf5l-00H60j-7I; Tue, 06 Sep 2022 20:22:41 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVf5h-00H5xI-B4 for linux-arm-kernel@lists.infradead.org; Tue, 06 Sep 2022 20:22:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662495755; 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: in-reply-to:in-reply-to:references:references; bh=6rfQm3A/tm7Sj95hHoCuXpvQKcgb4WAgDh0q01aC4qg=; b=U1rT34XtVUrh0NF8Jjv898YADzbCIC+Hb08Uh1C+CvdQsRecl1AkBLR91CdJjMGrX4LC4+ pL4bpYs2gA8IyKA/5RXAku+sSkbZEj6JvOw1+cEcRS/uLYBgnYyjJERma5aQW/q0v++5od pG2Qb9h7No06oBULPM55mB50NjPoTvc= 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_128_GCM_SHA256) id us-mta-507-wWRCCP7wP_mlX7U16UngXA-1; Tue, 06 Sep 2022 16:22:34 -0400 X-MC-Unique: wWRCCP7wP_mlX7U16UngXA-1 Received: by mail-qv1-f69.google.com with SMTP id db3-20020a056214170300b00496c0aabfc9so8662624qvb.16 for ; Tue, 06 Sep 2022 13:22:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=6rfQm3A/tm7Sj95hHoCuXpvQKcgb4WAgDh0q01aC4qg=; b=xG8cI9r/M4FTkoAQc2mzNicPRKOeuJUasZt5HBf+SedyrNBuksJvn8IM7fsYDv2nm+ NzlNArgp8uNFs9OZsmZgaibbxZ17QEn6rGJjLUDpTYNKGf8b5K7yBI6SRG/rGYcFlaE3 ngIzrnfGh97Y7GX/WY+dCaaQBllF/guQH2Gp/Kxa2LqCLuCRc3vHWJXR3EZztQTMgZxj mecGR0eo+lMsXo62TGdqtCkUGXE64ZCiajYUjqdGwhtEtLGyWGKO4YSjYAXXvIH8dpkc /nvmf860fDszINJNAnwdghfagWHkn2m9Y+dVQ8J8Rpo5fwqfEjt/TiDwCxQdm25d7lwQ CY+g== X-Gm-Message-State: ACgBeo1z0aU2jBKHKboLfi5VuT0SJIS0f/hfMk7Qo5m/teZshQSBm9xT zJdEAjq128Iafap29OxEPBY3Wf3Er9Lg2yQYdfGPliMqXLi/+RLVVt5ZjYxaye9t4oWwlYQa3+E m/4hSV6oxOtdk3e/j6fiHQP9kcdqMLtT9nrA= X-Received: by 2002:ad4:5ccc:0:b0:49a:87e:b21c with SMTP id iu12-20020ad45ccc000000b0049a087eb21cmr58574qvb.28.1662495753497; Tue, 06 Sep 2022 13:22:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR7HlEu+ZPwHInX004FIRhAcDe0jim1kS8RlEBcZxWCkXVNVfHqCq7f5i8MgInHqpj8yvoLXLQ== X-Received: by 2002:ad4:5ccc:0:b0:49a:87e:b21c with SMTP id iu12-20020ad45ccc000000b0049a087eb21cmr58555qvb.28.1662495753193; Tue, 06 Sep 2022 13:22:33 -0700 (PDT) Received: from xz-m1.local (bras-base-aurron9127w-grc-35-70-27-3-10.dsl.bell.ca. [70.27.3.10]) by smtp.gmail.com with ESMTPSA id u14-20020a05622a14ce00b00341a807ed21sm2137489qtx.72.2022.09.06.13.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 13:22:32 -0700 (PDT) Date: Tue, 6 Sep 2022 16:22:30 -0400 From: Peter Xu To: Suren Baghdasaryan Cc: Andrew Morton , Michel Lespinasse , Jerome Glisse , Michal Hocko , Vlastimil Babka , Johannes Weiner , Mel Gorman , Davidlohr Bueso , Matthew Wilcox , "Liam R. Howlett" , Peter Zijlstra , Laurent Dufour , Laurent Dufour , "Paul E . McKenney" , Andy Lutomirski , Song Liu , David Hildenbrand , dhowells@redhat.com, Hugh Dickins , Sebastian Andrzej Siewior , Kent Overstreet , David Rientjes , Axel Rasmussen , Joel Fernandes , Minchan Kim , kernel-team , linux-mm , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, LKML Subject: Re: [RFC PATCH RESEND 19/28] mm: disallow do_swap_page to handle page faults under VMA lock Message-ID: References: <20220901173516.702122-1-surenb@google.com> <20220901173516.702122-20-surenb@google.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220906_132237_494744_6CA35D80 X-CRM114-Status: GOOD ( 22.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 06, 2022 at 01:08:10PM -0700, Suren Baghdasaryan wrote: > On Tue, Sep 6, 2022 at 12:39 PM Peter Xu wrote: > > > > On Thu, Sep 01, 2022 at 10:35:07AM -0700, Suren Baghdasaryan wrote: > > > Due to the possibility of do_swap_page dropping mmap_lock, abort fault > > > handling under VMA lock and retry holding mmap_lock. This can be handled > > > more gracefully in the future. > > > > > > Signed-off-by: Suren Baghdasaryan > > > --- > > > mm/memory.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/mm/memory.c b/mm/memory.c > > > index 9ac9944e8c62..29d2f49f922a 100644 > > > --- a/mm/memory.c > > > +++ b/mm/memory.c > > > @@ -3738,6 +3738,11 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) > > > vm_fault_t ret = 0; > > > void *shadow = NULL; > > > > > > + if (vmf->flags & FAULT_FLAG_VMA_LOCK) { > > > + ret = VM_FAULT_RETRY; > > > + goto out; > > > + } > > > + > > > > May want to fail early similarly for handle_userfault() too for similar > > reason. Thanks, > > I wasn't aware of a similar issue there. Will have a closer look. Thanks! Sure. Just in case this would be anything helpful - handle_userfault() will both assert at the entry (mmap_assert_locked) and will in most cases release read lock along the way when waiting for page fault resolutions. And userfaultfd should work on anonymous memory for either missing mode or write protect mode. Thanks, -- Peter Xu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel