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 E7EF7C83F12 for ; Mon, 28 Aug 2023 17:27:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8F2C280020; Mon, 28 Aug 2023 13:27:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3E8E28001E; Mon, 28 Aug 2023 13:27:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0671280020; Mon, 28 Aug 2023 13:27:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id AE22E28001E for ; Mon, 28 Aug 2023 13:27:29 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7BF6B40258 for ; Mon, 28 Aug 2023 17:27:29 +0000 (UTC) X-FDA: 81174195018.24.9A0F3A4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 9220C120009 for ; Mon, 28 Aug 2023 17:27:27 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Nti3HNty; spf=pass (imf29.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693243647; a=rsa-sha256; cv=none; b=hZbUB+R5bfDHkkul4RT7FJkNetnGoMDUqBX56W86i5g+b0UZHqY8SsNmcBwcuzRCeldm6A xNawJa+JUw/Fzf9Ed5LQNDxu11DaC3nArBvP/HFDWYKcAI0MRxKFaMW05DyEOlt7DZaUc5 ecizArl1V/aai82lhm09NjyTEm64M6U= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Nti3HNty; spf=pass (imf29.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693243647; 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=mTV3kc++LcBibzlZRT0m+JhqLh8u4GMXYkeVqu8ur3w=; b=hiXq+VjN7Qi7P/H8VjAe4AT8pVlZdBHQjj5EexX/zsb5b+mNEvpd74rJmTDdK2Yj+nYOXJ HjQQs4Jj40hrjZInmgd/DWr32w7xppoC4KU1AaeBQDWhfElHt7QwpSn5JeWShOMg1xGJ08 bwv50Znteqe8I2GWd7r+Es2lUSQDKrY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693243647; 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=mTV3kc++LcBibzlZRT0m+JhqLh8u4GMXYkeVqu8ur3w=; b=Nti3HNtyWAFM1BRdZ3ZgcLvRsMZA2pY7PuwXbag4emgs69uN4A+JBT9Kj5oTYJ5OTUqKpb TLoyWTD2fDVdmJxClnQkRSKvtZq13/RmpedRl+SJdv9WmPtfbT220xqmcJa9MEICgP0qpj G/pYjID6XTLez3qfj7+JY+NVwNhNbs8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-12-ZX3kULIqOHqjBw6m8EMCig-1; Mon, 28 Aug 2023 13:27:24 -0400 X-MC-Unique: ZX3kULIqOHqjBw6m8EMCig-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2096B85CCE1; Mon, 28 Aug 2023 17:27:24 +0000 (UTC) Received: from [10.22.18.125] (unknown [10.22.18.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F44F492C14; Mon, 28 Aug 2023 17:27:23 +0000 (UTC) Message-ID: <599b167c-deaf-4b92-aa8b-5767b8608483@redhat.com> Date: Mon, 28 Aug 2023 13:27:23 -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: Yosry Ahmed , Shakeel Butt Cc: Michal Hocko , 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: <20230821205458.1764662-4-yosryahmed@google.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.9 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 9220C120009 X-Stat-Signature: 86n8bnzx65ufww6windqt6wsg3zuhjw9 X-Rspam-User: X-HE-Tag: 1693243647-138887 X-HE-Meta: U2FsdGVkX185AX7EH/MeEG/7okxd9KYwL0Ke5Ug2AxUxPvgd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w2FncDK92ig46CxjqgluogZH 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/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. Use spinlock if you want to have preemption disabled. The purpose of usiing mutex is to allow the lock owner to sleep, but you can't sleep with preemption disabled. You need to enable preemption first. You can disable preemption for a short time in a non-sleeping section of the lock critical section, but I would not recommend disabling preemption for the whole critical section. Cheers, Longman