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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 68CE3C433DB for ; Wed, 24 Feb 2021 19:11:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C6F6F64EC4 for ; Wed, 24 Feb 2021 19:11:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6F6F64EC4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 19BEF6B0005; Wed, 24 Feb 2021 14:11:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1253C6B0006; Wed, 24 Feb 2021 14:11:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2F8F6B006C; Wed, 24 Feb 2021 14:11:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id D8EAF6B0005 for ; Wed, 24 Feb 2021 14:11:10 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 92C653659 for ; Wed, 24 Feb 2021 19:11:10 +0000 (UTC) X-FDA: 77854104300.30.ED25188 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by imf08.hostedemail.com (Postfix) with ESMTP id 7717780192F2 for ; Wed, 24 Feb 2021 19:10:58 +0000 (UTC) Received: by mail-lj1-f178.google.com with SMTP id u4so3693158ljh.6 for ; Wed, 24 Feb 2021 11:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LsetPJB5m47FCg13KC6GjSTLKBsPDI7MuzXhPKMTnS4=; b=g0wCVRLuZhRAZSx2tZaeQKkHmjHJt6HcVeX1wF81XK3ID/P21CzwT5FyHF6bzyJiaK 7Wbpg65iES9Lwj24IG8yT/fkKOgtfPxfvdKC+qXihnsfhzxP5qlnVz0sgNHOO9KXWCV6 eIoO/wnpUtMRNAs14sprZgujgxrvqBNk1ASSY= 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=LsetPJB5m47FCg13KC6GjSTLKBsPDI7MuzXhPKMTnS4=; b=HDxTURIDdleOHKmGt8BkY/2RauDQd+sVl6rcxPXbmNCXRuMW6gm8zTG3q/CVUe2z3p 9WMGSXuhEljbhAEdjY9lZy5cQlxP8JB/Jk1EttpFDHhHSjeO593Ahx6SKtXgXKsnGXfU s5J5mGWDfMdPYYrKixH0OktIjayuu7dsR1XFUW+KFx3K4LTMCpS0HFdme1CasrXuRx3g bfsaByBu9kvmoSfmL0cwt0PU8PflJG/Ut1mfJ6eg816UqN54wpXKCWBfowtwBmSFusLP zAsjkgv+d0YZPlGKDUeoP5Xl8nMnfln3Z647cuSLQxCvhKt0r+weEHjkJF75E1Ij0iGP vpIg== X-Gm-Message-State: AOAM531ROCPd+v7kGv1xGH1IO7A6NKN01gsFOlZ0bfuK7jTbG9ap6Vsc noTnzNyYwwU24AYGXUTvnoG7TALMRnPjrA== X-Google-Smtp-Source: ABdhPJwz6j2JHemVCWqMrLdwvbkkHt+bhssprLVMGG9UToj8PU3110mGutXzSmMtrLj/2NPGWEDVjg== X-Received: by 2002:a2e:9086:: with SMTP id l6mr16285193ljg.93.1614193862797; Wed, 24 Feb 2021 11:11:02 -0800 (PST) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id c18sm664705lfr.140.2021.02.24.11.11.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Feb 2021 11:11:01 -0800 (PST) Received: by mail-lf1-f50.google.com with SMTP id m22so4719646lfg.5 for ; Wed, 24 Feb 2021 11:11:00 -0800 (PST) X-Received: by 2002:a05:6512:a8c:: with SMTP id m12mr20000602lfu.253.1614193859813; Wed, 24 Feb 2021 11:10:59 -0800 (PST) MIME-Version: 1.0 References: <20210224051845.GB6114@xsang-OptiPlex-9020> <20210224183828.j6uut6sholeo2fzh@example.org> In-Reply-To: <20210224183828.j6uut6sholeo2fzh@example.org> From: Linus Torvalds Date: Wed, 24 Feb 2021 11:10:43 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: d28296d248: stress-ng.sigsegv.ops_per_sec -82.7% regression To: Alexey Gladkov Cc: "Eric W. Biederman" , kernel test robot , 0day robot , LKML , lkp@lists.01.org, "Huang, Ying" , Feng Tang , zhengjun.xing@intel.com, io-uring , Kernel Hardening , Linux Containers , Linux-MM , Andrew Morton , Christian Brauner , Jann Horn , Jens Axboe , Kees Cook , Oleg Nesterov Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: nx8ajqgiz8c7whpfmosb1orogehd41w6 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 7717780192F2 Received-SPF: none (linuxfoundation.org>: No applicable sender policy available) receiver=imf08; identity=mailfrom; envelope-from=""; helo=mail-lj1-f178.google.com; client-ip=209.85.208.178 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614193858-793510 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 Wed, Feb 24, 2021 at 10:38 AM Alexey Gladkov wrote: > > One of the reasons for this is that I rolled back the patch that changed > the ucounts.count type to atomic_t. Now get_ucounts() is forced to use a > spin_lock to increase the reference count. Yeah, that definitely should be an atomic type, since the extended use of ucounts clearly puts way too much pressure on that ucount lock. I remember complaining about one version of that patch, but my complaint wasabout it changing semantics of the saturation logic (and I think it was also wrong because it still kept the spinlock for get_ucounts(), so it didn't even take advantage of the atomic refcount). Side note: I don't think a refcount_t" is necessarily the right thing to do, since the ucount reference counter does its own saturation logic, and the refcount_t version is imho not great. So it probably just needs to use an atomic_t, and do the saturation thing manually. Side note: look at try_get_page(). That one actually does refcounting with overflow protection better than refcount_t, in my opinion. But I am obviously biased, since I wrote it ;) See commits 88b1a17dfc3e mm: add 'try_get_page()' helper function f958d7b528b1 mm: make page ref count overflow check tighter and more explicit with that "page->_recount" being just a regular atomic_t. Linus