Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2268366rwo; Thu, 3 Aug 2023 07:10:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlHTgVA/7g3vrzC7WUJTOkysMkbFDIA2i5uY79PCmomdwLuqYAJ1BY5gdpEtm7agmXRs1dK5 X-Received: by 2002:a17:902:e5c2:b0:1b0:f8:9b2d with SMTP id u2-20020a170902e5c200b001b000f89b2dmr25089137plf.29.1691071828783; Thu, 03 Aug 2023 07:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691071828; cv=none; d=google.com; s=arc-20160816; b=qwjwXx9XKxEMKiuiiI0AOHkyTNQC7MiV7pzFL7kSQikU1n5b+Y2fZiqIDtZUNoI8yA jngAsOg5lE2FkNFsDxgftGxWPGdBWlYpq5B0sWXMAYv5/TEeJtFPQ11NoZTzyU+VhOIJ V/a+s+agypgN4JFUqGPscRu9pqkKyjBMIB4LcJETBxKaoCXM5cnSQPb7pD8PLpneJ8QG 0DlKec2xcU6kouuwdypBz1fRVhxfRq8vKCcX7ab0ZFmizrFYwWU1kTngdGhjG2LppNj6 Nd8q9DAocUvsth7lNlsSJb7sbKorc34FfJ7yTYu03QIVag69vW5pAsRzSjV5HdhZoybo xPcg== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=gl/GZ0rVwJHVsS52BdbNZrCS6aRBGRnTQuRxOvPwXLs=; fh=KtUxyydWOQD4ikgO23+kDYJZSaIOTGvBkAX0/JfUoOo=; b=BN1D5lUsGd25+R56muzX0YjO1VXoqNTNqhkWaaEfNXGzonNEREaBtbB0kRUyJxnqdR orZ0j/lVNBXc1INjidKKwor5drcaJq5K/FTTcAXM2qC6iZn9aIrNe1mAYMqmY7B4TPyy aFuUGowulrHjqhM4XNq7w0+HiOJ7HJhBGbKHtjrBUvS+Q5Jm0I0j3XqrrPq5sj4MZyH0 ArvdB6JufNhAif1jKkA6f1kCqJkn1f6NovLMO9pRtcQqlNCheoRmG+R9aFcb9Rd4ilxf 1jWVcs9SpagHmUukmtfW1bLalh1k4WD5BUw7KXMaJuIOE4EGVb2oOQfPi2eqt5rmr1Fy HawA== 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 s13-20020a170902ea0d00b001bbdd44bbd4si13417483plg.74.2023.08.03.07.10.15; Thu, 03 Aug 2023 07:10:28 -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 S236096AbjHCNSk (ORCPT + 99 others); Thu, 3 Aug 2023 09:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235189AbjHCNSY (ORCPT ); Thu, 3 Aug 2023 09:18:24 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F432E6F for ; Thu, 3 Aug 2023 06:18:23 -0700 (PDT) Received: from fsav117.sakura.ne.jp (fsav117.sakura.ne.jp [27.133.134.244]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 373DIL50004362; Thu, 3 Aug 2023 22:18:21 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav117.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav117.sakura.ne.jp); Thu, 03 Aug 2023 22:18:21 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav117.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 373DIA4l004327 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Thu, 3 Aug 2023 22:18:21 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <60d4dc52-9281-9266-4294-b514bd09e6e8@I-love.SAKURA.ne.jp> Date: Thu, 3 Aug 2023 22:18:10 +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() To: Michal Hocko , Sebastian Andrzej Siewior Cc: Petr Mladek , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Luis Claudio R. Goncalves" , Andrew Morton , Boqun Feng , Ingo Molnar , John Ogness , Mel Gorman , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon References: <20230623171232.892937-1-bigeasy@linutronix.de> <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> Content-Language: en-US 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, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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/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" !? My initial proposal was "[PATCH] mm/page_alloc: don't check zonelist_update_seq from atomic allocations" at https://lkml.kernel.org/r/dfdb9da6-ca8f-7a81-bfdd-d74b4c401f11@I-love.SAKURA.ne.jp . Compared to that version, this what-you-call-hairy version has an improvement that - return read_seqbegin(&zonelist_update_seq); + return data_race(READ_ONCE(zonelist_update_seq)); can eliminate while ((__seq = seqprop_sequence(s)) & 1) cpu_relax(); path. There is no need to wait for completion of rebuilding zonelists, for rebuilding zonelists being in flight (indicated by zonelist_update_seq being odd) does not mean that allocation never succeeds. When allocation did not fail, this "while" loop becomes nothing but a waste of CPU time, And it is very likely that rebuilding zonelists being not in flight from the beginning. We can make zonelist_iter_begin() (which is always called as long as __alloc_pages_slowpath() is called) faster and simpler, which is an improvement even without considering printk() and lockdep/KCSAN related problems.