Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3467705rwb; Mon, 5 Sep 2022 12:13:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR67UtfNkvOnKpZIIaRKVx/rXrPDvvr+BJA2WfhkCHYeTdHVzUAbLMbLdHJN8bQaPSUTYegA X-Received: by 2002:a17:902:eb82:b0:176:c0e0:55c1 with SMTP id q2-20020a170902eb8200b00176c0e055c1mr2728467plg.168.1662405188893; Mon, 05 Sep 2022 12:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662405188; cv=none; d=google.com; s=arc-20160816; b=M+JKZi30exRiqwEDspeScHieh5tPVoByGrFAhI96AMD2lygdUiqMCv7iSAwFLO/wvM knlDMsp2qZlWwqK3k2cJnpToHbaaM8xv8JzjUTvD9nVDUCrfa5DUJxVF6pSdDimoUXGg DvlTCkMZWZ4Y7wXinTjZGSwTCP77zMw2pj/2UX8L5WVtzOJGAiXN1zrzX5Z2M4l9SThj X5+JTbx1vYfHywoSsSa9VZTqeyxDRVTn90tjvmFRJalD58sKrVPsiHpNertnouq2L25x HnbYrdzbHU4XRJwssGRGM6QtkmB6/st63ro6o30SMqQ22sCAs77CeOcI7kmWskw5clR4 wQGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FNv/KEMtf5XOtkND3AyjhcP/3pLjOBMwZm4O4kjr360=; b=CVBGqOMX6stNwaz9dkoobiRhRvH93+8Nd8pVoBHtER76n9d/to2SCHK+RH+gudQdCL JRUu4QVmoLezBviRLJOXltvDiKYnpUylUL3F1DWjk0sqalOr+hUpH/YhHojrvSOFipOY 7XV+uu8KCbsxjDnyDUBYpQF2ZuQrpEAuwlc3ljwcMzN47hLQqUvbKphT+ZT2m4ZdXmOb r9YWQV+F5qXNmKtJwfdDI+mPySE/4ik7PHTX9x6RPKZRbbTz7LF57l3rG35GLAEHRKqm 9+U6gglWQbrQyYv5Z2BVlxIBYLV/uuRihBB+i8msvaeKmIKQwZIRVmhtUpHTvT+HO8W/ IPlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=i5KCDSUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l197-20020a633ece000000b0042b4d1b0dcbsi12520935pga.216.2022.09.05.12.12.57; Mon, 05 Sep 2022 12:13:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=i5KCDSUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231726AbiIESdC (ORCPT + 99 others); Mon, 5 Sep 2022 14:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbiIESdB (ORCPT ); Mon, 5 Sep 2022 14:33:01 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C1EA52805 for ; Mon, 5 Sep 2022 11:33:00 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id d68so7282343iof.11 for ; Mon, 05 Sep 2022 11:33:00 -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=FNv/KEMtf5XOtkND3AyjhcP/3pLjOBMwZm4O4kjr360=; b=i5KCDSUH/dFt94fpjc7Fphku0Tn3reBabaBpFtdU+oRbFh+e8Cx/DMlqQivEg1MZjm 7FbOvlY6Y9f+9LZ9N+zgTB71z3cagQ2sGfp1oudx0Kv1xpUW6Up8K51vig+01CsmnL3L C3xCWMqLQrpYBGvHC0UNi+yNQ6XvxIjh2dsHMNd34BBtJz1xyaPEvWMxsK55kusb2lJe FYhU7ADU9KYt1l8KwJpBXu48E1hUBJcr2CIqnesgVXkiai+CuNr/V0a+QqiqySxoUimH yIvsq78rMCW0kTv83Fiph1I394+CJ8Hgoqi6ZFAZmMb3pGsqLwLA4vfAoG5DeUW7LJqa cUpw== 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=FNv/KEMtf5XOtkND3AyjhcP/3pLjOBMwZm4O4kjr360=; b=mQ7S+59FA8Qgp/dZvrlb9nu3nGnKIA2zX/5Q8jAyOEKLiZHnLOBYij7ZHAAiZuN7zo NmqFXa2JIjs42V0d+DCn3rRgsJpg24Z63QCWIqNFQen2IRE6VxWnRI/Ys9C72bRaBcoG TWIf2orifCA/DotlvKs2R2odFLsGqAWZq87JdjlNVD83n+vVIYQH5nOKXAr8r7NZsDCo Oyb1057fCsN70WygDRjk43uE1A2ivVO3KuFAUeQnHONLbH+s5swjiMHmDi/dicQPRDgZ UVwCciG5QjLe9e93vAM+N8KDrCQwzSB5+xR/z9dVQ0TsDiedsa3CpHW3gcj/JPGav81W 1Jog== X-Gm-Message-State: ACgBeo0GlNVBcX0MyxUl3IyEXI0xUV6aosSPKQ4Bsfg2wT0Ww+QxVEJe H/tA53i+ENzZDOkaxyplU0Jw74hIs254ClvBMWr6CQ== X-Received: by 2002:a02:740b:0:b0:349:bcdd:ca20 with SMTP id o11-20020a02740b000000b00349bcddca20mr28183219jac.110.1662402779688; Mon, 05 Sep 2022 11:32:59 -0700 (PDT) MIME-Version: 1.0 References: <20220901173516.702122-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 5 Sep 2022 11:32:48 -0700 Message-ID: Subject: Re: [RFC PATCH RESEND 00/28] per-VMA locks proposal To: Michal Hocko Cc: Andrew Morton , Michel Lespinasse , Jerome Glisse , Vlastimil Babka , Johannes Weiner , Mel Gorman , Davidlohr Bueso , Matthew Wilcox , "Liam R. Howlett" , Peter Zijlstra , Laurent Dufour , Laurent Dufour , "Paul E . McKenney" , Andy Lutomirski , Song Liu , Peter Xu , David Hildenbrand , dhowells@redhat.com, Hugh Dickins , Sebastian Andrzej Siewior , Kent Overstreet , David Rientjes , Axel Rasmussen , Joel Fernandes , Minchan Kim , kernel-team , linux-mm , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 5, 2022 at 5:32 AM 'Michal Hocko' via kernel-team wrote: > > Unless I am missing something, this is not based on the Maple tree > rewrite, right? Does the change in the data structure makes any > difference to the approach? I remember discussions at LSFMM where it has > been pointed out that some issues with the vma tree are considerably > simpler to handle with the maple tree. Correct, this does not use the Maple tree yet but once Maple tree transition happens and it supports RCU-safe lookups, my code in find_vma_under_rcu() becomes really simple. > > On Thu 01-09-22 10:34:48, Suren Baghdasaryan wrote: > [...] > > One notable way the implementation deviates from the proposal is the way > > VMAs are marked as locked. Because during some of mm updates multiple > > VMAs need to be locked until the end of the update (e.g. vma_merge, > > split_vma, etc). > > I think it would be really helpful to spell out those issues in a greater > detail. Not everybody is aware of those vma related subtleties. Ack. I'll expand the description of the cases when multiple VMAs need to be locked in the same update. The main difficulties are: 1. Multiple VMAs might need to be locked within one mmap_write_lock/mmap_write_unlock session (will call it an update transaction). 2. Figuring out when it's safe to unlock a previously locked VMA is tricky because that might be happening in different functions and at different call levels. So, instead of the usual lock/unlock pattern, the proposed solution marks a VMA as locked and provides an efficient way to: 1. Identify locked VMAs. 2. Unlock all locked VMAs in bulk. We also postpone unlocking the locked VMAs until the end of the update transaction, when we do mmap_write_unlock. Potentially this keeps a VMA locked for longer than is absolutely necessary but it results in a big reduction of code complexity. > > Thanks for working on this Suren! Thanks for reviewing! Suren. > -- > Michal Hocko > SUSE Labs > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >