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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A371EC83F12 for ; Tue, 29 Aug 2023 15:05:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 178418E002C; Tue, 29 Aug 2023 11:05:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 128C88E001A; Tue, 29 Aug 2023 11:05:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F0C288E002C; Tue, 29 Aug 2023 11:05:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E09A98E001A for ; Tue, 29 Aug 2023 11:05:40 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BED40B21AE for ; Tue, 29 Aug 2023 15:05:40 +0000 (UTC) X-FDA: 81177466440.01.D8CB038 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id C9C2B40016 for ; Tue, 29 Aug 2023 15:05:37 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IS4vkQeC; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693321537; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZA14b/tmA/wTpAgcSwxLG1sI93f6oKp/7oBZg84XpyU=; b=XyooUHTlFXrd0HS0hlRZDfHrW+7ydN74wGM4+TWsDoaYH7yhyJGcBijL7mpa86ZoVqGI0e Ki//hI8NZVrh/SntKog1DUKmb+3w0WwB8vG5pIlMPYXUJue/CdKkfMVjAnKs5FLIdyy4G8 bMiJlky/Sp6Y44KgdAO6wU9iYt5KCFo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IS4vkQeC; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693321537; a=rsa-sha256; cv=none; b=3/tvKoGK0/X5zInzKyO+xRmHFKiuYBXuUKwSpOX6UGGBN4jLk5mj8+/m4sR6OGS+v5L95o zRJsF/6PDoh9ugtEez9vngwFpN2PvBjxPq8vhIaECcHbr6nbscPHt3HCNQfLGE5j2g8BHy oTWvRbOEbKrZVrEmtLpyfAyQ+TKLXXs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693321537; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZA14b/tmA/wTpAgcSwxLG1sI93f6oKp/7oBZg84XpyU=; b=IS4vkQeCczVm6rXyXHm0UqzM6NWmcJ1y253cDVf9f8M2qWiJHxHDNlANFJt37L175pL3D4 h4P4vSp3IIfYalZ3oDYvC116y580qXUa17cXeUhUmcc5i0+ZPMuts1pQT5WeveR6tOjRae PiwRwHyXEUVZBFta9INb4ZB8XLU1vbg= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-92-3ooSx6BrNa-TgUQ_eCcCgw-1; Tue, 29 Aug 2023 11:05:30 -0400 X-MC-Unique: 3ooSx6BrNa-TgUQ_eCcCgw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 536141C0CCB6; Tue, 29 Aug 2023 15:05:29 +0000 (UTC) Received: from [10.22.16.214] (unknown [10.22.16.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94F54140E950; Tue, 29 Aug 2023 15:05:28 +0000 (UTC) Message-ID: <5906501e-4dff-4c66-7ab3-e9193d312270@redhat.com> Date: Tue, 29 Aug 2023 11:05:28 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH 3/3] mm: memcg: use non-unified stats flushing for userspace reads Content-Language: en-US To: Michal Hocko Cc: Yosry Ahmed , Shakeel Butt , Andrew Morton , Johannes Weiner , Roman Gushchin , Muchun Song , Ivan Babrou , Tejun Heo , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org References: <599b167c-deaf-4b92-aa8b-5767b8608483@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C9C2B40016 X-Stat-Signature: 4p371hhmpacr4tdqxbshz3tqnxhyn3by X-HE-Tag: 1693321537-706666 X-HE-Meta: U2FsdGVkX19eOjYwITZR7lnMKTvTUiHW5k4lQpWfOchz2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mA9MDSUBuKoPvn9dlVYjJGQKTXz5PR/52hclV5GBoytdeDtuecyZp0+cBWWE7soqFCPs2KjMc5w/CNR1uNlvcnYFOYZGZTkdCcI62+9IizbQ5A1mlUypy6Zrwf 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 8/29/23 03:27, Michal Hocko wrote: > On Mon 28-08-23 13:27:23, Waiman Long wrote: >> On 8/28/23 13:07, Yosry Ahmed wrote: >>>> Here I agree with you. Let's go with the approach which is easy to >>>> undo for now. Though I prefer the new explicit interface for flushing, >>>> that step would be very hard to undo. Let's reevaluate if the proposed >>>> approach shows negative impact on production traffic and I think >>>> Cloudflare folks can give us the results soon. >>> Do you prefer we also switch to using a mutex (with preemption >>> disabled) to avoid the scenario Michal described where flushers give >>> up the lock and sleep resulting in an unbounded wait time in the worst >>> case? >> Locking with mutex with preemption disabled is an oxymoron. > I believe Yosry wanted to disable preemption _after_ the lock is taken > to reduce the time spent while it is held. The idea to use the mutex is > to reduce spinning and more importantly to get rid of lock dropping > part. It is not really clear (but unlikely) we can drop it while > preserving the spinlock as the thing scales with O(#cgroups x #cpus) > in the worst case. As I have said later in my email, I am not against disabling preemption selectively on some parts of the lock critical section where preemption is undesirable. However, I am against disabling preemption for the whole duration of the code where the mutex lock is held as it defeats the purpose of using mutex in the first place. Cheers, Longman