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 X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01BEEC433DF for ; Fri, 14 Aug 2020 08:35:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D13B8206DA for ; Fri, 14 Aug 2020 08:35:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="oqVy0fps" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726979AbgHNIfw (ORCPT ); Fri, 14 Aug 2020 04:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbgHNIfw (ORCPT ); Fri, 14 Aug 2020 04:35:52 -0400 Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC32EC061383 for ; Fri, 14 Aug 2020 01:35:50 -0700 (PDT) Received: by mail-yb1-xb43.google.com with SMTP id e14so4820212ybf.4 for ; Fri, 14 Aug 2020 01:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AdqxtBBzE8zkm3kxwd6M5EQuKDKvTyliTVOnv4Gy5lw=; b=oqVy0fpsXt6mcaf8A0SC3B/hbz8tbu1sLp+p2pRxvv8AbXvXwBHIFsfkMCRqNri3GF qJ5LaxL7IMvfVknso37KHelMIw8Dd2z7cxXhdshfuODzyH2Xseg89iJdaKUlQjvHq7Hq lhVM/0EfF59L/acBDsdGpzOFVzg978mH+5YR0Xnus5a+hauEXlwXVyH0k/uzyUQXeOV+ GoD9sItD5ZTLV2cb+jVfv+1qVPtgrDmNyETiLEcVRayEQDHThAdY1wjwZE3Exe3WMAGf B0CMyWrcmpON8PTov2dXTjRTU6wL6B8HVQWcoUhp+BuAHQUBWllyB0qzr6niC+D7+S2F fxHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AdqxtBBzE8zkm3kxwd6M5EQuKDKvTyliTVOnv4Gy5lw=; b=HjLoSOJTQfwseycxreI59sUFE6mUunqnrzkGCDcqmkpsW7Ae8tIfAI9StYCBdPnyed FlUBUQvrsUcrzegxFoKnDLt5KcE89gC+rJh2gN+b/BopN0Kl5jLyNi7YNhvkQer6byYm ZY/kPFzrYaebs3ulVKwH9L8y3SB6JSUykJ2F7ZmHlQcEGwZcz01v1HSM/gNLvTKCseoe A3hECLbphA8f0g0rEY9x8ErmccbrZKweszKQ4JpsHJ3/8zCekrUGBj9zsdGZ9JcTUy+m Ob0PBod9CEsC99ufdMsnpJk11qGTiz95uB9549mP6kOIbFUJjmNMQIx+Y75XjzCbD7pq AJyw== X-Gm-Message-State: AOAM533P+dHZ0yj/tYZjjMxEBxbPrcw52ztdQN0/M9zdJg+ID25oxj8V vKfwR3igW3WmaucpoFvQhYaBS0wRR9FdVB2MJxD3Hw== X-Google-Smtp-Source: ABdhPJy4hZxzSJG2zp9/9fyOvZB1bpfPoOKRLt/YSmrRg6wSBSlJmdqUtSRvhcYGxO1/TjNY1yNIgU0oMFRVQUhfajs= X-Received: by 2002:a25:7455:: with SMTP id p82mr2121422ybc.287.1597394149918; Fri, 14 Aug 2020 01:35:49 -0700 (PDT) MIME-Version: 1.0 References: <1597284810-17454-1-git-send-email-chinwen.chang@mediatek.com> <1597284810-17454-3-git-send-email-chinwen.chang@mediatek.com> In-Reply-To: <1597284810-17454-3-git-send-email-chinwen.chang@mediatek.com> From: Michel Lespinasse Date: Fri, 14 Aug 2020 01:35:37 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] mm: proc: smaps_rollup: do not stall write attempts on mmap_lock To: Chinwen Chang Cc: Matthias Brugger , Andrew Morton , Vlastimil Babka , Daniel Jordan , Davidlohr Bueso , Alexey Dobriyan , "Matthew Wilcox (Oracle)" , Jason Gunthorpe , Steven Price , Song Liu , Jimmy Assarsson , Huang Ying , LKML , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-fsdevel@vger.kernel.org, wsd_upstream@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 12, 2020 at 7:13 PM Chinwen Chang wrote: > smaps_rollup will try to grab mmap_lock and go through the whole vma > list until it finishes the iterating. When encountering large processes, > the mmap_lock will be held for a longer time, which may block other > write requests like mmap and munmap from progressing smoothly. > > There are upcoming mmap_lock optimizations like range-based locks, but > the lock applied to smaps_rollup would be the coarse type, which doesn't > avoid the occurrence of unpleasant contention. > > To solve aforementioned issue, we add a check which detects whether > anyone wants to grab mmap_lock for write attempts. I think your retry mechanism still doesn't handle all cases. When you get back the mmap lock, the address where you stopped last time could now be in the middle of a vma. I think the consistent thing to do in that case would be to retry scanning from the address you stopped at, even if it's not on a vma boundary anymore. You may have to change smap_gather_stats to support that, though. 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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06E7CC433E1 for ; Fri, 14 Aug 2020 08:36:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C674720774 for ; Fri, 14 Aug 2020 08:36:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GbKxeeVr"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="oqVy0fps" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C674720774 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=05uzJZeNECR7FJ13+Pq//flJRXPD/9sLeFvxlxR378w=; b=GbKxeeVrUsSHKYFKoTGoVD/9f M9iolRNNwiSMmJdq0THQstS9ttZOnCHxCBf9/3lHPysr7eVKRtWXSqMiZQxBYQtr5m88YkGGb6Pse x4Va8U+AziRJbj29fF1HVi4tK3KyEjRUHlblll526KERP8NvAANxLF5LbUiLNC6EOyERZv6LaNMEp mkLqgMb6r7duN4hsVHzlFDyuubGcriJJyBwoPx2qHUNCasVaeYV1Lcqav11Jf+ya23s/l4VEVWi1t I7w3VgRUQIfezAtTgdKpq3GTFT3Zn15I2PrDNZYsrFNsq2n8OMpqPlIxnRMjJ8lsICvteVMf6vl8z oGHBJsHhQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6VBq-0000lT-Io; Fri, 14 Aug 2020 08:35:54 +0000 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6VBo-0000ju-05 for linux-mediatek@lists.infradead.org; Fri, 14 Aug 2020 08:35:53 +0000 Received: by mail-yb1-xb43.google.com with SMTP id a34so4790229ybj.9 for ; Fri, 14 Aug 2020 01:35:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AdqxtBBzE8zkm3kxwd6M5EQuKDKvTyliTVOnv4Gy5lw=; b=oqVy0fpsXt6mcaf8A0SC3B/hbz8tbu1sLp+p2pRxvv8AbXvXwBHIFsfkMCRqNri3GF qJ5LaxL7IMvfVknso37KHelMIw8Dd2z7cxXhdshfuODzyH2Xseg89iJdaKUlQjvHq7Hq lhVM/0EfF59L/acBDsdGpzOFVzg978mH+5YR0Xnus5a+hauEXlwXVyH0k/uzyUQXeOV+ GoD9sItD5ZTLV2cb+jVfv+1qVPtgrDmNyETiLEcVRayEQDHThAdY1wjwZE3Exe3WMAGf B0CMyWrcmpON8PTov2dXTjRTU6wL6B8HVQWcoUhp+BuAHQUBWllyB0qzr6niC+D7+S2F fxHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AdqxtBBzE8zkm3kxwd6M5EQuKDKvTyliTVOnv4Gy5lw=; b=XEv/hz0e6LC3t9QVxrYx4qHC6/I5tcMpRkU1i3GAjt4x/czunpuUb3rRl0c/CCcRnT wcpgLpgIUyH8av6iIIrjz2DhCWjPieDbWmrib7FtuCM8umKtHGy+x2jE3xgVAKt5biTb RYIU3nHbfRd+TZJ4XmK9quwP1unyEU8jsB6pxlGiQKGeZje6b58gKBPDVvBrrIrf78qV w6N19eS9s4ToNbTzsPhtAtrGNFy81eypWjIEIfHI7y0XKlqbprNvux5GUnK+WSpb6f1B IWtBoBHznl0Q+uDRS+lckoxoKyogtymD32PESwfPJgPAvm5gWhVktgb5PCEaJ4QNXZgW yLTg== X-Gm-Message-State: AOAM530tw2hjRBNeuPZtI8XFoltvzR8koloik6AR5uM6hTvBlJ4N9Drl QlstcmuZSpECpC7EWMP9zszqfFbJucs42ExCTWJhaQ== X-Google-Smtp-Source: ABdhPJy4hZxzSJG2zp9/9fyOvZB1bpfPoOKRLt/YSmrRg6wSBSlJmdqUtSRvhcYGxO1/TjNY1yNIgU0oMFRVQUhfajs= X-Received: by 2002:a25:7455:: with SMTP id p82mr2121422ybc.287.1597394149918; Fri, 14 Aug 2020 01:35:49 -0700 (PDT) MIME-Version: 1.0 References: <1597284810-17454-1-git-send-email-chinwen.chang@mediatek.com> <1597284810-17454-3-git-send-email-chinwen.chang@mediatek.com> In-Reply-To: <1597284810-17454-3-git-send-email-chinwen.chang@mediatek.com> From: Michel Lespinasse Date: Fri, 14 Aug 2020 01:35:37 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] mm: proc: smaps_rollup: do not stall write attempts on mmap_lock To: Chinwen Chang X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200814_043552_516583_0C2F2C56 X-CRM114-Status: GOOD ( 13.25 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Song Liu , wsd_upstream@mediatek.com, Davidlohr Bueso , LKML , "Matthew Wilcox \(Oracle\)" , Daniel Jordan , Jason Gunthorpe , linux-mediatek@lists.infradead.org, Jimmy Assarsson , Huang Ying , Matthias Brugger , linux-fsdevel@vger.kernel.org, Andrew Morton , Steven Price , Alexey Dobriyan , Vlastimil Babka Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Wed, Aug 12, 2020 at 7:13 PM Chinwen Chang wrote: > smaps_rollup will try to grab mmap_lock and go through the whole vma > list until it finishes the iterating. When encountering large processes, > the mmap_lock will be held for a longer time, which may block other > write requests like mmap and munmap from progressing smoothly. > > There are upcoming mmap_lock optimizations like range-based locks, but > the lock applied to smaps_rollup would be the coarse type, which doesn't > avoid the occurrence of unpleasant contention. > > To solve aforementioned issue, we add a check which detects whether > anyone wants to grab mmap_lock for write attempts. I think your retry mechanism still doesn't handle all cases. When you get back the mmap lock, the address where you stopped last time could now be in the middle of a vma. I think the consistent thing to do in that case would be to retry scanning from the address you stopped at, even if it's not on a vma boundary anymore. You may have to change smap_gather_stats to support that, though. _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek 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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBB66C433E1 for ; Fri, 14 Aug 2020 08:37:14 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 844912074D for ; Fri, 14 Aug 2020 08:37:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="09r4wROk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="oqVy0fps" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 844912074D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5IM/GbvA0W2AclFKEqrcgjwJz5Q5DL2y4ZOc56aJEuo=; b=09r4wROkJY5H4dq5v4nelqNmg 9t/7XiGfnNBtim5j4CQn31RxBfV9PRV+qW5/lU2/6aB3Ghj/ATgjJQP/Y4nidEHscmYGKMUhJox4l r98oNp9gBwdFvLq+GtKICOrBjvETtFj2caPbbNaIm9j7iKe2OnoYBcpwnjvyzqCkSjn8kzgYXKGi4 1yzivOXhv1wmaPkDxsjrpUTgi/tklhFMG1HdxtnpBKiKx2ue186HpwL7bX07UhbYCQk/H1QTstP1w gWSzB9VQuK3m3ktPPvBBKugKhU4P//oRbLkvEbCuAkRYe/QOolf+XIUTHLk4f1RGtjkv2j4BJmdO+ WczNh+KzA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6VBr-0000ls-L0; Fri, 14 Aug 2020 08:35:55 +0000 Received: from mail-yb1-xb41.google.com ([2607:f8b0:4864:20::b41]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6VBo-0000jv-04 for linux-arm-kernel@lists.infradead.org; Fri, 14 Aug 2020 08:35:54 +0000 Received: by mail-yb1-xb41.google.com with SMTP id p191so4822354ybg.0 for ; Fri, 14 Aug 2020 01:35:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AdqxtBBzE8zkm3kxwd6M5EQuKDKvTyliTVOnv4Gy5lw=; b=oqVy0fpsXt6mcaf8A0SC3B/hbz8tbu1sLp+p2pRxvv8AbXvXwBHIFsfkMCRqNri3GF qJ5LaxL7IMvfVknso37KHelMIw8Dd2z7cxXhdshfuODzyH2Xseg89iJdaKUlQjvHq7Hq lhVM/0EfF59L/acBDsdGpzOFVzg978mH+5YR0Xnus5a+hauEXlwXVyH0k/uzyUQXeOV+ GoD9sItD5ZTLV2cb+jVfv+1qVPtgrDmNyETiLEcVRayEQDHThAdY1wjwZE3Exe3WMAGf B0CMyWrcmpON8PTov2dXTjRTU6wL6B8HVQWcoUhp+BuAHQUBWllyB0qzr6niC+D7+S2F fxHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AdqxtBBzE8zkm3kxwd6M5EQuKDKvTyliTVOnv4Gy5lw=; b=FfUtPxlgOX0hZ9EdTXNOU+3azQXEgWY4WLGUdYgKabIRY7tXUPT8+hjQb7LJMI1UwB Rby/O2rPztDsvh1ciVtlRqGJvw//E4AkVyHYYult9qPn4TLn8Gq7SywnacWzUQZ//tUd Iwcw4SybCuEZuk6+0DDezgPhvJu/4k1lxCcJcuV+wUQ4aUDdeoy57renk/6dmM2PzK/d kuw5tMZSw70GCELtGjWpfvB4p1nhAjddP/nwU+ply3ztRvHTy4Bwnj06RZKrlfWIiRIK YMLzsJmIMOxKpJFy4L2By3o734LGvCutZ3kDQgKUVODcpzFH6lvgJ9DvlDcdx7AsBJS1 h9+Q== X-Gm-Message-State: AOAM531Xnpjj2ElRKpqx9M12wG9XfDizHE7AyXMq8DuVUc/i9QNST/Aa tlOh81uC1LV8R355nsa7We69Fl739T1esZvCCtum1g== X-Google-Smtp-Source: ABdhPJy4hZxzSJG2zp9/9fyOvZB1bpfPoOKRLt/YSmrRg6wSBSlJmdqUtSRvhcYGxO1/TjNY1yNIgU0oMFRVQUhfajs= X-Received: by 2002:a25:7455:: with SMTP id p82mr2121422ybc.287.1597394149918; Fri, 14 Aug 2020 01:35:49 -0700 (PDT) MIME-Version: 1.0 References: <1597284810-17454-1-git-send-email-chinwen.chang@mediatek.com> <1597284810-17454-3-git-send-email-chinwen.chang@mediatek.com> In-Reply-To: <1597284810-17454-3-git-send-email-chinwen.chang@mediatek.com> From: Michel Lespinasse Date: Fri, 14 Aug 2020 01:35:37 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] mm: proc: smaps_rollup: do not stall write attempts on mmap_lock To: Chinwen Chang X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200814_043552_541886_4F9DAF40 X-CRM114-Status: GOOD ( 14.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Song Liu , wsd_upstream@mediatek.com, Davidlohr Bueso , LKML , "Matthew Wilcox \(Oracle\)" , Daniel Jordan , Jason Gunthorpe , linux-mediatek@lists.infradead.org, Jimmy Assarsson , Huang Ying , Matthias Brugger , linux-fsdevel@vger.kernel.org, Andrew Morton , Steven Price , Alexey Dobriyan , Vlastimil Babka Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 12, 2020 at 7:13 PM Chinwen Chang wrote: > smaps_rollup will try to grab mmap_lock and go through the whole vma > list until it finishes the iterating. When encountering large processes, > the mmap_lock will be held for a longer time, which may block other > write requests like mmap and munmap from progressing smoothly. > > There are upcoming mmap_lock optimizations like range-based locks, but > the lock applied to smaps_rollup would be the coarse type, which doesn't > avoid the occurrence of unpleasant contention. > > To solve aforementioned issue, we add a check which detects whether > anyone wants to grab mmap_lock for write attempts. I think your retry mechanism still doesn't handle all cases. When you get back the mmap lock, the address where you stopped last time could now be in the middle of a vma. I think the consistent thing to do in that case would be to retry scanning from the address you stopped at, even if it's not on a vma boundary anymore. You may have to change smap_gather_stats to support that, though. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel