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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 B3F0BC38145 for ; Tue, 6 Sep 2022 20:09:05 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MMc0c2f8vz301Z for ; Wed, 7 Sep 2022 06:09:04 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=m8rk4SWG; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=google.com (client-ip=2607:f8b0:4864:20::12d; helo=mail-il1-x12d.google.com; envelope-from=surenb@google.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=m8rk4SWG; dkim-atps=neutral Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4MMbzv307Mz2xHM for ; Wed, 7 Sep 2022 06:08:26 +1000 (AEST) Received: by mail-il1-x12d.google.com with SMTP id e7so6540051ilc.5 for ; Tue, 06 Sep 2022 13:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=xXYqmgNj8Tmj+x9M5f+04P5dGXCMQoJ15NQDTyzFADc=; b=m8rk4SWGAohfkoYbpdwdbzCtTDUzSXWWGs5XiL42MbO9eUE0KkcAYJtigCpi9ZiVNM XRpBlpbqZwXmwRi9Nu33ABMaIniF1jEHqbW4ibZa4VuMko12DcRlsp/s+LV6WxLiKUuc DlfoAjSQiq7WPBBE1H0eJXzkvrbAVqNEfHSySVRwxI4xwPffNFz/azZDxOMKUNiN3Ouc 7vutba0HCoTD9TjCbtMYQAiBlFuUgL4kHcRgMCO70oFgb/HnnUnaLa2Z+vFBz7EwfT/e UjoQCVppiPyeulYLjD59K/Xfz+Ua8hohlBdVSzf0piAJ4TW92nmjmGtCKP2RKU2CH0AC U7Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=xXYqmgNj8Tmj+x9M5f+04P5dGXCMQoJ15NQDTyzFADc=; b=DVbE+KyGuVJSM+II0x3OTWEBX1phj6g8+V1J4ZTFbk81NwMDF0WgXgmY8kuDN019yS eAO6YVZSe7zEyyOi3mC+dhgStoSDxzt64v2bib5Ef4I/g6e0zEXYpX3Q9+Xq2rjNanfR 1izwDXQY31p+5kSx+xwSFTkyFGUdiSCXqyECArHJXJkiNQ/okLZcSulmmaCUBrqqjHpp SNEnloQogvABP/gIyPhznxxCKQP8GWhROIdjFIMkHpyxPpbTAO2ixZ0rraf1X0HsKt8r O73/qoiVV/JL2rQRpuz1YXuHBGFDpYkFCTKWJugVQIPybqm5Yg+T+xV3FWG10cuEMWV3 5LQA== X-Gm-Message-State: ACgBeo3ic7Va+TjDrSpZ0wwveMfZ7AtTKGykIACGSIE3GWO9oJ/KDu9l nzcqTNFzwloGE0KXV5E5NU1LenL8WBnbFRRHZex6bw== X-Google-Smtp-Source: AA6agR4kK/DxJZ/QWl7YVW2Lx89QOwSRT/InEkv6rZ+riJpikx1NlRv2IBjPMwhu7ALyb9V69oOBORt1uVJaIEcSenM= X-Received: by 2002:a92:ca0f:0:b0:2ee:5577:e447 with SMTP id j15-20020a92ca0f000000b002ee5577e447mr103285ils.215.1662494902370; Tue, 06 Sep 2022 13:08:22 -0700 (PDT) MIME-Version: 1.0 References: <20220901173516.702122-1-surenb@google.com> <20220901173516.702122-20-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 6 Sep 2022 13:08:10 -0700 Message-ID: Subject: Re: [RFC PATCH RESEND 19/28] mm: disallow do_swap_page to handle page faults under VMA lock To: Peter Xu Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michel Lespinasse , Joel Fernandes , Song Liu , Michal Hocko , David Hildenbrand , Peter Zijlstra , Sebastian Andrzej Siewior , dhowells@redhat.com, linux-mm , Jerome Glisse , Davidlohr Bueso , Minchan Kim , x86@kernel.org, Hugh Dickins , Matthew Wilcox , Laurent Dufour , Mel Gorman , David Rientjes , Axel Rasmussen , kernel-team , "Paul E . McKenney" , "Liam R. Howlett" , Andy Lutomirski , Laurent Dufour , Vlastimil Babka , linux-arm-kernel@lists.infradead.org, Kent Overstreet , LK ML , Johannes Weiner , Andrew Morton , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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! > > -- > Peter Xu >