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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E061FC83F11 for ; Mon, 28 Aug 2023 17:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230085AbjH1R23 (ORCPT ); Mon, 28 Aug 2023 13:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232838AbjH1R2Q (ORCPT ); Mon, 28 Aug 2023 13:28:16 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08F8CE1 for ; Mon, 28 Aug 2023 10:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693243650; 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=dAuTewKKarS5GexVgo9iPT5pnh54hhLPML/ogK8Ne6MMdCZ7bKP5IfEtgSfPpNLOt4v78n sFH9aTe4GGm0KnY6PYadO+/6ZiD67gigZ8FfmvSBPbIzAiPgT+ENaFUkCb3ylkzcJHvmxY 3V/ncAlNWxsQ79P/TyZTRSBIAUpgEVU= 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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