Message ID | 20230109205336.3665937-22-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 89823C61DB3 for <linux-mm@archiver.kernel.org>; Mon, 9 Jan 2023 20:54:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E0F38E0015; Mon, 9 Jan 2023 15:54:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2914F8E0001; Mon, 9 Jan 2023 15:54:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 132238E0015; Mon, 9 Jan 2023 15:54:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 045D08E0001 for <linux-mm@kvack.org>; Mon, 9 Jan 2023 15:54:37 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D12881C64F3 for <linux-mm@kvack.org>; Mon, 9 Jan 2023 20:54:36 +0000 (UTC) X-FDA: 80336464152.11.261C14F Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf11.hostedemail.com (Postfix) with ESMTP id 3FF1540011 for <linux-mm@kvack.org>; Mon, 9 Jan 2023 20:54:35 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=dyW75mch; spf=pass (imf11.hostedemail.com: domain of 3Cn-8YwYKCB8NPM9I6BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3Cn-8YwYKCB8NPM9I6BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673297675; a=rsa-sha256; cv=none; b=5Tm4C17Hii5UH4biN4TNVjRU0PVw/9UuGAOWHZ4lGMT/xNXnJlT64nPC8jF9WRJ9T3DjOx olsZuERidf4PFY/OOjWAgwrKjfHi2BRbk8PcI/eobIv87IS16RVHvZOfozOAvq/SIXzK8p GxVgsJLa3WiVg7aiYLWNJoR45ytYLy4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=dyW75mch; spf=pass (imf11.hostedemail.com: domain of 3Cn-8YwYKCB8NPM9I6BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3Cn-8YwYKCB8NPM9I6BJJBG9.7JHGDIPS-HHFQ57F.JMB@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673297675; 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=1sz3d8Q6zHAextbGhc5zNdx6/hdXqibZ5+zjxQEPtcY=; b=YA/sdzSZ36exnabVYIWZkHcwshcohM+gXdaqSOistsAZVNsYE+koL4NPjWDJ9hYYaOuvJe PT8P30w2cpCCKEI6+82zgGpP3Ul49X8TyZ4t8Eidtkf/HLkwXmzUGNRBYyJY8YGrxB6rtu w4zb52xHDYThB7p7R9KOD+ykvHMCC3A= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-487b0bf1117so104147417b3.5 for <linux-mm@kvack.org>; Mon, 09 Jan 2023 12:54:34 -0800 (PST) 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:subject:date:message-id:reply-to; bh=1sz3d8Q6zHAextbGhc5zNdx6/hdXqibZ5+zjxQEPtcY=; b=dyW75mchIm8T3L3V0Aa5O5essWjp4aFupYS1LFKIISIPYObh/dim0X80nsutKOS2m/ 7vd6AcHVv3F7nL+fFOG4vgOpiulnyZtSLux8AIxMn/Q09ghgqU9hpb0yvL9ry+wKM1Wm UvSXVlZK7VJVWgc1kVtRM87LVA0ol6j3197yqrcZsN3y1TKaMHMTXNPpOvk38N+aLEKf U9xTtNcWgL4MRS7DZ4GXXUuetaMZa2ezppHTDMHc58pzPdKSGBN9qWFGFMwk1DYAuR6m mxxVO9djRkO0qH7ZMi64I+oMQN0AQu1sYjF82YaLSmfJI9fTdyDigl7Wn8SgruW4bLXZ WU7A== 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:subject:date:message-id:reply-to; bh=1sz3d8Q6zHAextbGhc5zNdx6/hdXqibZ5+zjxQEPtcY=; b=m2SOABMXsL4FiLF7t5Cs/ipCjNk5g2NO5GnMcDopCYlpBtKT1yVstQxBbnm2SMObc5 3DdFDo2FDH82qW2Sx8e00/AUu8yDua/F42ZRk27EaoyjnfL5mHnf0w9soAiWEbxnZZa5 6wqO61Y04vxep3BppoZsXnu55jNWaCohdzNLi/GIS4JMrAoqC3e96JZF8x+77h59kIc+ yXCCYFFlFaborUQgwRiWvUlpYtAvoWj3RWIyGUo1GN/gSFkrfGvqSBJrTqRRX2LGo9Rt PR6TDKMh13io2juoSEokm0A6YQRw78AtSMS2bY59//SVQImBK/4i1J0zYN+v7ms02GwC kN8w== X-Gm-Message-State: AFqh2kpbNOJE9AXsBFrByyIEwxzGnvCWwiv6i1nWQMKX02EVH0ejmLwP VG1nGgXczth99LyO+AbtovQ67bH+qL8= X-Google-Smtp-Source: AMrXdXvYJ0MKAPgXdwWnp9E6tLdKAmG2zH31TOsESiFv0D3eqJovHEz4lb9T2t60zhYoFlt31PHaEzcWVdQ= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:9393:6f7a:d410:55ca]) (user=surenb job=sendgmr) by 2002:a25:830b:0:b0:731:a583:5571 with SMTP id s11-20020a25830b000000b00731a5835571mr8144189ybk.320.1673297674437; Mon, 09 Jan 2023 12:54:34 -0800 (PST) Date: Mon, 9 Jan 2023 12:53:16 -0800 In-Reply-To: <20230109205336.3665937-1-surenb@google.com> Mime-Version: 1.0 References: <20230109205336.3665937-1-surenb@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230109205336.3665937-22-surenb@google.com> Subject: [PATCH 21/41] mm/mmap: write-lock VMAs affected by VMA expansion 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, 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, punit.agrawal@bytedance.com, lstoakes@gmail.com, peterjung1337@gmail.com, rientjes@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, jannh@google.com, shakeelb@google.com, tatashin@google.com, edumazet@google.com, gthelen@google.com, gurua@google.com, arjunroy@google.com, soheil@google.com, hughlynch@google.com, leewalsh@google.com, posk@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com, surenb@google.com Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-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QTOvtaL5E2SW9 Oi0JlmWJ sE1JJU54ruc0cjozyxcbw2xCoOaC17pQJrszLf1ielIbLT0ye0UdxJS1vmd5SYZsmoQlqT7Z6wUCrLzuQ++DiQWliWB2ui//fo0WZQ4mg+ra0kylJqLuE6FgZGAK0u1PZjhSeSP1VuO7794w49vkovdLo93i9WPQYrLgS1jZRbAjlak2OajZ47OMLiDQLCGNKTj5Jk1E7KYa5XpKtMazha7U8It9HiCW/ZTIogx18Y7NhG5IZ8rzYctZzZWVlaBbWT87V5Lpsf9mHT4XbLaW2Ok95u2lmZbU/W7dVFm7ciLdhqX+oDNAYe4ZPXrtRP02SA4m0DnvVPNA0HA3B+BLdWXjxm8eIszWEpiWNqC4WTgaI0rw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001636, 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
|
expand
|
diff --git a/mm/mmap.c b/mm/mmap.c index 1e2154137631..ff02cb51e7e7 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -544,6 +544,7 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma, if (mas_preallocate(mas, vma, GFP_KERNEL)) goto nomem; + vma_write_lock(vma); vma_adjust_trans_huge(vma, start, end, 0); if (file) { @@ -590,6 +591,7 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma, } if (remove_next) { + vma_write_lock(next); if (file) { uprobe_munmap(next, next->vm_start, next->vm_end); fput(file);
vma_expand changes VMA boundaries and might result in freeing an adjacent VMA. Write-lock affected VMAs to prevent concurrent page faults. Signed-off-by: Suren Baghdasaryan <surenb@google.com> --- mm/mmap.c | 2 ++ 1 file changed, 2 insertions(+)