Message ID | 20220829212531.3184856-8-surenb@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 6B74AECAAD8 for <linux-mm@archiver.kernel.org>; Mon, 29 Aug 2022 21:25:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDF5094000B; Mon, 29 Aug 2022 17:25:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4117940008; Mon, 29 Aug 2022 17:25:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6EEF94000B; Mon, 29 Aug 2022 17:25:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9FD18940008 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 17:25:49 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5C7E71606E1 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 21:25:49 +0000 (UTC) X-FDA: 79853912418.18.7822891 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by imf15.hostedemail.com (Postfix) with ESMTP id 00C7AA0040 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 21:25:48 +0000 (UTC) Received: by mail-pg1-f202.google.com with SMTP id f186-20020a636ac3000000b0042af745d56cso4590773pgc.17 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 14:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc; bh=knlkft8CSs4ctk+Wf5EGoFcT9IapAOL4+B6Ai/+T1Ew=; b=P37RAGhPa0fj1eu5oWQ75AvAaLtugohQsYRWKzKsYPy82nTGbYS2huH/UiZNVvoE/s 88nyZ5hMCHsleX96EzwxSRzBq/7CUKc/bHbJ31Ts1GLCvmDOU9CmcQD2WQXDTk1c+h7j 3oIUBNbln4Bxomo0AKLbatKVQNVrzgPz+A4aQoGdDS5LbHfkkFmAcE6pV6uk/ymeBjbJ 1nc4oAeG1urj8/jUSameTDeH8ziLxBTZVHP9LQuagPlJAxjluMekWoC6NIdC1YJBWEbt nn2+QyaYYhDKNwmBnD8p146GgfwAnKteHIAkGMz5qwPGMxUQt1Cd0qMSAU4DAqNB0mVB aVgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc; bh=knlkft8CSs4ctk+Wf5EGoFcT9IapAOL4+B6Ai/+T1Ew=; b=tEEAwzouXbLRt+/oeivhrhSdHYtItZqhzDIzSXPj8v+pdG+tHrU5kGJgBPyUT/bM1Z u9nWTnk4e2ZZsHZsGt3FcauSNUMkwpm+ZBcrnZAXsRp7FdK3dY2/P053wk4uW/MnlZmF mkL7u/c/rd63cg/oxDG2JDcMItdjGiOjaSFKtXAT6mWG2t+Sr9zxbgWZifS2c3qZWMGV wojWnQgzzBis+HwhGC16J5c2YnSlOhzZRMUSR4tLcWzYrBrvbyobG8wEhj+jRSa8AAhQ uTED80vQFZZhvW0+yh9eH3JXJQw2ckuSGTS+KqWDqtxU33FMZVtAeK1MvEgh/FJhkZyL V3Fg== X-Gm-Message-State: ACgBeo01zVr8oFV2XMNUTFPGWkyLVYOBBLygbBdfoEzNYwWd42uiWZun h/Z5XeKjH8Ny9n/LkSUXVMU0NVGBlqc= X-Google-Smtp-Source: AA6agR7ucJtBhSAnuB+PqV9qzppZFKeEkxBUzS6um9UDd2r/XYBs5DAVo1iLh4VL9E0CKz9mlSvmLd+h5RQ= X-Received: from surenb-spec.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e30]) (user=surenb job=sendgmr) by 2002:aa7:8d08:0:b0:538:105a:eb6a with SMTP id j8-20020aa78d08000000b00538105aeb6amr10112054pfe.42.1661808348114; Mon, 29 Aug 2022 14:25:48 -0700 (PDT) Date: Mon, 29 Aug 2022 21:25:10 +0000 In-Reply-To: <20220829212531.3184856-1-surenb@google.com> Mime-Version: 1.0 References: <20220829212531.3184856-1-surenb@google.com> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220829212531.3184856-8-surenb@google.com> Subject: [RFC PATCH 07/28] kernel/fork: mark VMAs as locked before copying pages during fork From: Suren Baghdasaryan <surenb@google.com> To: akpm@linux-foundation.org Cc: michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mgorman@techsingularity.net, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, peterz@infradead.org, ldufour@linux.ibm.com, laurent.dufour@fr.ibm.com, paulmck@kernel.org, riel@surriel.com, luto@kernel.org, songliubraving@fb.com, peterx@redhat.com, david@redhat.com, dhowells@redhat.com, hughd@google.com, bigeasy@linutronix.de, kent.overstreet@linux.dev, rientjes@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, surenb@google.com, kernel-team@android.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661808349; a=rsa-sha256; cv=none; b=lR6JhBknyZyN4B/3mtNyvG9Ekk1chR+L3wzWRV4SCWfPiFsddMiSpFkQd6M6ETCxvPqjkN WfjJlwolA7V8iziYNJsoCEiupj4Wi8r5My4y+hsmhnrrMIbMemIjydDSsr5tAmKmAVKHr5 YJISeRUaPBmdcLeCj3N3SC+NlDYdQ7M= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=P37RAGhP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf15.hostedemail.com: domain of 33C4NYwYKCI09B8v4sx55x2v.t532z4BE-331Crt1.58x@flex--surenb.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=33C4NYwYKCI09B8v4sx55x2v.t532z4BE-331Crt1.58x@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661808349; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=knlkft8CSs4ctk+Wf5EGoFcT9IapAOL4+B6Ai/+T1Ew=; b=TUsKqgIBBZ5nUH6Cha+aC/fBmsz0kjalqfE9zeVW1PZ7tOAml10fREIBvJoO7XpElOeR18 ePgCK+z6TWQWniAIF/g4bYkD+7jA1Glx7pxizIT5j0nCnS0UWKDj9MonTO8SIEmCdYilrU QCX621/+0ni1gsgnsy7Tbi3TY2aQU7U= X-Stat-Signature: yr81d4czkywh5uqf98yiiqpkia8wsz4d X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 00C7AA0040 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=P37RAGhP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf15.hostedemail.com: domain of 33C4NYwYKCI09B8v4sx55x2v.t532z4BE-331Crt1.58x@flex--surenb.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=33C4NYwYKCI09B8v4sx55x2v.t532z4BE-331Crt1.58x@flex--surenb.bounces.google.com X-Rspam-User: X-HE-Tag: 1661808348-599932 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000320, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
per-VMA locks proposal
|
expand
|
diff --git a/kernel/fork.c b/kernel/fork.c index bfab31ecd11e..1872ad549fed 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -709,8 +709,10 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, rb_parent = &tmp->vm_rb; mm->map_count++; - if (!(tmp->vm_flags & VM_WIPEONFORK)) + if (!(tmp->vm_flags & VM_WIPEONFORK)) { + vma_mark_locked(mpnt); retval = copy_page_range(tmp, mpnt); + } if (tmp->vm_ops && tmp->vm_ops->open) tmp->vm_ops->open(tmp);
Protect VMAs from concurrent page fault handler while performing copy_page_range for VMAs having VM_WIPEONFORK flag set. Signed-off-by: Suren Baghdasaryan <surenb@google.com> --- kernel/fork.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)