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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29F5EC433F5 for ; Tue, 7 Dec 2021 23:08:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8940B6B0072; Tue, 7 Dec 2021 18:08:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 842626B0073; Tue, 7 Dec 2021 18:08:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70A936B0074; Tue, 7 Dec 2021 18:08:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id 61CE06B0072 for ; Tue, 7 Dec 2021 18:08:42 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2988589B3B for ; Tue, 7 Dec 2021 23:08:32 +0000 (UTC) X-FDA: 78892539264.16.188235A Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf16.hostedemail.com (Postfix) with ESMTP id C57E6F00008F for ; Tue, 7 Dec 2021 23:08:31 +0000 (UTC) Received: by mail-yb1-f173.google.com with SMTP id q74so1537223ybq.11 for ; Tue, 07 Dec 2021 15:08:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lRGAev7E9rKsBfzE8rVm/cgWBvl8Wsl3a2S3zf5VBy8=; b=PPRJZURpqVRgSTfc7Nr8cFealNWVTbNpUySCqBM3oRRkKcetpG7iiI0K+M8+mjImhX pKwU1baysS3T+YERbd4QWVcOzuxXYZVvhlkKpvpiCUBh70uNfNZXNembGCh7Sb/lfWZk p/V6bPhCsWli62X6CvipyjsvTcNrH/j7tFhpP5ab0i0Y9VzjMDvArx0SOQF/rXVihgtg Iw6uoNqJaw+7hJaTGCBktS7PFfHaycv053JtM9c6Trkrw5RaBbnQf7Ssk5fiySnxRe5p x4vU9RWx3tvrEhPFChpDWZuTesmwul3bYhwW2m1M6Y10aUGkmSDlJ0Lf2XDkY01aQWYk ZisA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lRGAev7E9rKsBfzE8rVm/cgWBvl8Wsl3a2S3zf5VBy8=; b=azAMxDSvJurdatb9eXZcfWwy8mBwx9tOwlWiJv5+KoiCOb8+VPgPR0v9Iq+TzG1tIF hcr+kK4en1zymjnywMekFtO7WTGuXgFB3/KScVPbDMn1mtSanwxiDynG0GuQ7AhkSkuC KQyW787SL/blACBexYiCPJop2PndHc1yeV4Yr33VEAPbK5RmbLWYze4/mUEDpCrel43B hVR6fjLXW1V23igu1IetsorvRnI3FYNVwnJyA4F44nt2vHuNRL12R21VeQjojK2y7aZH yktcABZcpDMU9tuxN+tf2bVveiq2lPM6OuL8d3UtrGrzXbQJJfwtWe8tE+TVKlkjA44h J7og== X-Gm-Message-State: AOAM532rOrBAoudMxZr5VQJ+Fwl6xktFfKha/5uVETAXJ7yRJiOxtVBQ g+2v0JaSKp/ciKLstc8wyXv7nlPBUNLVs2WhCoIT7g== X-Google-Smtp-Source: ABdhPJwjSdFUsVfx4V7nDizmuk5wveIpt2khnP4YDL+B5L668iwYp4izqrQpnK2K1m9hL8AMW8lzgybGsJybQpjQsfw= X-Received: by 2002:a25:6ec5:: with SMTP id j188mr54674582ybc.602.1638918510741; Tue, 07 Dec 2021 15:08:30 -0800 (PST) MIME-Version: 1.0 References: <20211207215031.2251719-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 7 Dec 2021 15:08:19 -0800 Message-ID: Subject: Re: [PATCH v3 1/2] mm: protect free_pgtables with mmap_lock write lock in exit_mmap To: Matthew Wilcox Cc: akpm@linux-foundation.org, mhocko@kernel.org, mhocko@suse.com, rientjes@google.com, hannes@cmpxchg.org, guro@fb.com, riel@surriel.com, minchan@kernel.org, kirill@shutemov.name, aarcange@redhat.com, christian@brauner.io, hch@infradead.org, oleg@redhat.com, david@redhat.com, jannh@google.com, shakeelb@google.com, luto@kernel.org, christian.brauner@ubuntu.com, fweimer@redhat.com, jengelh@inai.de, timmurray@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: moak64p99gx954fts7hert7koze76txe Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=PPRJZURp; spf=pass (imf16.hostedemail.com: domain of surenb@google.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: C57E6F00008F X-HE-Tag: 1638918511-29166 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: On Tue, Dec 7, 2021 at 2:47 PM Suren Baghdasaryan wrote: > > On Tue, Dec 7, 2021 at 2:07 PM Matthew Wilcox wrote: > > > > On Tue, Dec 07, 2021 at 01:50:30PM -0800, Suren Baghdasaryan wrote: > > > - Added a comment for vm_operations_struct::close, documenting restriction for > > > taking mmap_lock in the callback, per Michal Hocko and Matthew Wilcox > > > > This should be a separate patch because it stands alone, but ... > > I thought about it and since it was relevant to the change in > remove_vma locking, I thought it would fit here. However, if you > insist on splitting it, I'll post it as a separate patch. Please let > me know. > > > > > > struct vm_operations_struct { > > > void (*open)(struct vm_area_struct * area); > > > + /* > > > + * Called with mmap_lock lock held for write from __split_vma and > > > + * remove_vma, therefore should never take that lock. > > > + */ > > > > Your whitespace indentation is weird. And it'd be nice to make this a > > kernel-doc comment (I know none of the others are, but that should be > > fixed too). And naming the functions that call it is wrong too. > > > > /** > > * @close: Called when the VMA is being removed from the MM. > > * Context: Caller holds mmap_lock. BTW, is the caller always required to hold mmap_lock for write or it *might* hold it? > > */ > > Ack. Will change and include in the next respin once I hear from you > on the preference for a separate patch. > Thanks!