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 0C7EFC433F5 for ; Wed, 8 Dec 2021 08:56:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E8166B0074; Wed, 8 Dec 2021 03:56:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 896B96B0075; Wed, 8 Dec 2021 03:56:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 786256B0078; Wed, 8 Dec 2021 03:56:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay034.a.hostedemail.com [64.99.140.34]) by kanga.kvack.org (Postfix) with ESMTP id 69BB56B0074 for ; Wed, 8 Dec 2021 03:56:29 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 358C0120374 for ; Wed, 8 Dec 2021 08:56:19 +0000 (UTC) X-FDA: 78894020478.12.AFB826B Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf17.hostedemail.com (Postfix) with ESMTP id B3EF3F000136 for ; Wed, 8 Dec 2021 08:56:18 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 87B9D212B7; Wed, 8 Dec 2021 08:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638953777; h=from:from:reply-to: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=PtiOHarMjUzcPZDcJ9qWp4eAA9eXBT5zJWjDVyQGWvM=; b=CYRyyfagNt+TyyqEDi82nZ7rUeelq+HO00S3BxPdD3cKLSxaRAeRkNw7btKdePJjGNCALO v/7pFhOimr6wrd5KeDov1s/vxemgid1mmCNPiIR4qAiZYjx3XPrLbuKmrjQ962CASMDZIY fUhrWdM83tTZZFT3n9ewgOj1LSEDBGw= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 1746FA3B81; Wed, 8 Dec 2021 08:56:17 +0000 (UTC) Date: Wed, 8 Dec 2021 09:56:16 +0100 From: Michal Hocko To: Suren Baghdasaryan Cc: Matthew Wilcox , akpm@linux-foundation.org, 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 Subject: Re: [PATCH v3 1/2] mm: protect free_pgtables with mmap_lock write lock in exit_mmap Message-ID: References: <20211207215031.2251719-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B3EF3F000136 X-Stat-Signature: y4y3gq6ibyyq7rsh9ekfjpug4unzcgmb Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=CYRyyfag; spf=pass (imf17.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-HE-Tag: 1638953778-149648 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 07-12-21 15:08:19, Suren Baghdasaryan wrote: > 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? I would go with might -- Michal Hocko SUSE Labs