Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3549949rwo; Fri, 4 Aug 2023 06:40:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHT3ghTvjzHR4mKMo4Crn8WGqbPwLtVQ/1TzJay6EaYBS5UdognaDAqV+cNf6OL8LQmojtj X-Received: by 2002:a05:6a00:3984:b0:687:2f1e:156a with SMTP id fi4-20020a056a00398400b006872f1e156amr2074188pfb.5.1691156414637; Fri, 04 Aug 2023 06:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691156414; cv=none; d=google.com; s=arc-20160816; b=hqEUyxrLcYnE92rXjfQHHi/o6VABfFe2GZ9k89vGWSft2GGoleDLRl1j3tVbMu8RNG XQol97EdvZ8+lO1vg2l7oyYLbZCUlNXfOCSvIEl38cnntMJg5vTJI83cew+l37peoRaY ujfxPL1YKbcLJBr+KBqNVVq5Q7rmEgtNBCQtNSgEj1/ojt0FxBSM2WL2rGE6wqP7xJ/n 3eMmxkAuyZXzV8gutDyvAY6PczUw9UFexFr+dYmniLH5Lt2Jj1oOhdgP3fiQbLdHUD/t AXm5A0+CzlBgqezejj6VTFpZP7pixoHtgGiLGZSMWo7GITAC4peXcZ7CkA5KbjQXfkCu JgpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=2EKr41WM0JCER9RY7vlE/rW4XxqL9PlOnk4TbPgdnRY=; fh=RdO0kEJnpRXLYD3hFTqe1R2DQTTADdBd6+Ps+SP0olI=; b=adqtlEtwJIgp/Uc9fW9FjTtrZZy3uPFEhtAePk0XK7AxGH2Cbe7B7Lao/9hSmk5E/L bK9MTSP23vECrs6yiEg+9i4/sQwA62KZNLL9ly6R+RjIgJ42YDTgMQgqPs2JKwp2Wqqs tkQNNi1PJrnPOkQ4dluowMmM8C5s+6IbXFsIGPW0505FaEHBzCcDJpQyfJMBOFNeBo4A XM1YULc0fO4mQIRWzC0b8ouJ3dAykGEwvijU3dtQSBQmOO9yCXWLoapwNX/4aeizQWtx j/Vni/25bgq9VyEe2VEQWllONz/8PX3Yx4YDnjwznMygXBzjMe2D/1Q3xHws5cND7p+O JD3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h69-20020a638348000000b005633d19281bsi1710239pge.401.2023.08.04.06.40.01; Fri, 04 Aug 2023 06:40:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230481AbjHDN2P (ORCPT + 99 others); Fri, 4 Aug 2023 09:28:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231265AbjHDN16 (ORCPT ); Fri, 4 Aug 2023 09:27:58 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7739D4C0A for ; Fri, 4 Aug 2023 06:27:33 -0700 (PDT) Received: from fsav412.sakura.ne.jp (fsav412.sakura.ne.jp [133.242.250.111]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 374DRMAA042544; Fri, 4 Aug 2023 22:27:22 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav412.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav412.sakura.ne.jp); Fri, 04 Aug 2023 22:27:22 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav412.sakura.ne.jp) Received: from [192.168.1.6] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 374DRLxE042538 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Fri, 4 Aug 2023 22:27:22 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <2505f6d3-5a10-49e7-960f-12c31a62a366@I-love.SAKURA.ne.jp> Date: Fri, 4 Aug 2023 22:27:22 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH v2 1/2] seqlock: Do the lockdep annotation before locking in do_write_seqcount_begin_nested() Content-Language: en-US To: Michal Hocko , Sebastian Andrzej Siewior , Andrew Morton Cc: Petr Mladek , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Luis Claudio R. Goncalves" , Boqun Feng , Ingo Molnar , John Ogness , Mel Gorman , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon References: <20230623171232.892937-2-bigeasy@linutronix.de> <20230626081254.XmorFrhs@linutronix.de> <20230727151029.e_M9bi8N@linutronix.de> <649fa1a7-4efd-8cc7-92c7-ac7944adc283@I-love.SAKURA.ne.jp> <60d4dc52-9281-9266-4294-b514bd09e6e8@I-love.SAKURA.ne.jp> From: Tetsuo Handa In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/08/03 23:49, Michal Hocko wrote: > On Thu 03-08-23 22:18:10, Tetsuo Handa wrote: >> On 2023/07/31 23:25, Michal Hocko wrote: >>> On Sat 29-07-23 20:05:43, Tetsuo Handa wrote: >>>> On 2023/07/29 14:31, Tetsuo Handa wrote: >>>>> On 2023/07/28 0:10, Sebastian Andrzej Siewior wrote: >>>>>> On 2023-06-28 21:14:16 [+0900], Tetsuo Handa wrote: >>>>>>>> Anyway, please do not do this change only because of printk(). >>>>>>>> IMHO, the current ordering is more logical and the printk() problem >>>>>>>> should be solved another way. >>>>>>> >>>>>>> Then, since [PATCH 1/2] cannot be applied, [PATCH 2/2] is automatically >>>>>>> rejected. >>>>>> >>>>>> My understanding is that this patch gets applied and your objection will >>>>>> be noted. >>>>> >>>>> My preference is that zonelist_update_seq is not checked by !__GFP_DIRECT_RECLAIM >>>>> allocations, which is a low-hanging fruit towards GFP_LOCKLESS mentioned at >>>>> https://lkml.kernel.org/r/ZG3+l4qcCWTPtSMD@dhcp22.suse.cz and >>>>> https://lkml.kernel.org/r/ZJWWpGZMJIADQvRS@dhcp22.suse.cz . >>>>> >>>>> Maybe we can defer checking zonelist_update_seq till retry check like below, >>>>> for this is really an infrequent event. >>>>> >>>> >>>> An updated version with comments added. >>> >>> Seriously, don't you see how hairy all this is? And for what? Nitpicking >>> something that doesn't seem to be a real problem in the first place? >> >> Seriously, can't you find "zonelist_update_seq is not checked by !__GFP_DIRECT_RECLAIM >> allocations, which is a low-hanging fruit towards GFP_LOCKLESS" !? > > I do not think we have concluded that we want to support GFP_LOCKLESS. > This might be trivial straightforward now but it imposes some constrains > for future maintainability. So far we haven't heard about many usecases > where this would be needed and a single one is not sufficient IMHO. When you introduced a word GFP_LOCKLESS in the link above, I was wondering the meaning of "LESS" part. Since we know that it is difficult to achieve "hold 0 lock during memory allocation", "hold least locks during memory allocation" will be at best. Therefore, GFP_LOCKLESS is as misleading name as GFP_ATOMIC. GFP_LOCK_LEAST or GFP_LEAST_LOCKS will represent the real behavior better. Like I said I consider that memory allocations which do not do direct reclaim should be geared towards less locking dependency. in the thread above, I still believe that this what-you-call-hairy version (which matches "hold least locks during memory allocation" direction) is better than "[PATCH v3 2/2] mm/page_alloc: Use write_seqlock_irqsave() instead write_seqlock() + local_irq_save()." (which does not match "hold least locks during memory allocation"). My version not only avoids possibility of deadlock, but also makes zonelist_iter_begin() faster and simpler. Not holding zonelist_update_seq lock is trivially doable compared to removing __GFP_KSWAPD_RECLAIM from GFP_ATOMIC. Please give me feedback about which line of my proposal is technically unsafe, instead of discarding my proposal with negative words like "hairy".