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 X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E0B3C3A5A9 for ; Mon, 4 May 2020 18:08:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 523242073B for ; Mon, 4 May 2020 18:08:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="gnaxHkTW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 523242073B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D1DBF8E006B; Mon, 4 May 2020 14:08:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CCE2E8E0058; Mon, 4 May 2020 14:08:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE54E8E006B; Mon, 4 May 2020 14:08:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id A899E8E0058 for ; Mon, 4 May 2020 14:08:07 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7398C180AD83B for ; Mon, 4 May 2020 18:08:07 +0000 (UTC) X-FDA: 76779820614.06.spy64_63fd584191805 X-HE-Tag: spy64_63fd584191805 X-Filterd-Recvd-Size: 5128 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 18:08:06 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id b6so438612qkh.11 for ; Mon, 04 May 2020 11:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8lqlcqzLSXs6kQK5WzXKsA6SXfOJlZ0T+LEde0fpTBU=; b=gnaxHkTW0xp32Dnjn0U3/jhSQEoLB3QVuJZRpwpZQqGjQpILV2SWkM0bQgd73dRrsh V/J7zKNRB3rG2HTqPTTN47hpUnZBw81Uv14JodvK3TSNjF1447WH41WQOwua+88IdE35 RQ58FtnvDfzr+hliOFTTwbzGh4QByFIFewB78= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8lqlcqzLSXs6kQK5WzXKsA6SXfOJlZ0T+LEde0fpTBU=; b=koUeWOJw3jf2m8mrdnVcWzLuhp0wIT4R3x1mAKDSymdrXHHugjACqbZNXvottAf1b0 +eM4dAaNVFctZ821GqMOeE3XvO6M4+151ooAI8Sg1I50Rcgspwl/CFz4ZY+USCn/dysI 8yxLYhwYGfsc+w6xgevleokItUllvpd1r1W9hFupVm13hHm+YR8ZrTRDYcysdU4Qmjec louQ1E8NqNw/9flTEA74p5kB1r9bwdbshO+bMO22cRmh2MTIc55DEU1DxZ6JXRpbCtrx VbeXgGvJa5SRz8rGcJHE8w2dbwplfmU4yzORZtxxfrinGZytaiCd6HHOJgC5MJSI8/KY TlIg== X-Gm-Message-State: AGi0PubPFmQRnrVBYVL5rD2VleITWTHdcAOP/gAae+zY6UVW7HlFyvbK NGH5olNjZyVlBo5UC1VMCpJDeA== X-Google-Smtp-Source: APiQypI5eZszvopLJuDAZRuwCkGzdKXSDC/oOtdUeAQZtCszD77WvOxRYkXISoFQHLqf83/FhKwcrg== X-Received: by 2002:a37:809:: with SMTP id 9mr468583qki.93.1588615686148; Mon, 04 May 2020 11:08:06 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id g16sm8606827qkk.122.2020.05.04.11.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 11:08:05 -0700 (PDT) Date: Mon, 4 May 2020 14:08:05 -0400 From: Joel Fernandes To: Uladzislau Rezki Cc: "Paul E. McKenney" , LKML , linux-mm@kvack.org, Andrew Morton , "Theodore Y . Ts'o" , Matthew Wilcox , RCU , Oleksiy Avramchenko Subject: Re: [PATCH 09/24] rcu/tree: cache specified number of objects Message-ID: <20200504180805.GA172409@google.com> References: <20200428205903.61704-1-urezki@gmail.com> <20200428205903.61704-10-urezki@gmail.com> <20200501212749.GD7560@paulmck-ThinkPad-P72> <20200504124323.GA17577@pc636> <20200504152437.GK2869@paulmck-ThinkPad-P72> <20200504174822.GA20446@pc636> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200504174822.GA20446@pc636> 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 Mon, May 04, 2020 at 07:48:22PM +0200, Uladzislau Rezki wrote: > On Mon, May 04, 2020 at 08:24:37AM -0700, Paul E. McKenney wrote: [..] > > > > Presumably the list can also be accessed without holding this lock, > > > > because otherwise we shouldn't need llist... > > > > > > > Hm... We increase the number of elements in cache, therefore it is not > > > lockless. From the other hand i used llist_head to maintain the cache > > > because it is single linked list, we do not need "*prev" link. Also > > > we do not need to init the list. > > > > > > But i can change it to list_head. Please let me know if i need :) > > > > Hmmm... Maybe it is time for a non-atomic singly linked list? In the RCU > > callback processing, the operations were open-coded, but they have been > > pushed into include/linux/rcu_segcblist.h and kernel/rcu/rcu_segcblist.*. > > > > Maybe some non-atomic/protected/whatever macros in the llist.h file? > > Or maybe just open-code the singly linked list? (Probably not the > > best choice, though.) Add comments stating that the atomic properties > > of the llist functions aren't neded? Something else? > > > In order to keep it simple i can replace llist_head by the list_head? Just to clarify for me, what is the disadvantage of using llist here? Since we don't care about traversing backwards, isn't it better to use llist for this usecase? I think Vlad is using locking as we're also tracking the size of the llist to know when to free pages. This tracking could suffer from the lost-update problem without any locking, 2 lockless llist_add happened simulatenously. Also if list_head is used, it will take more space and still use locking. Thoughts? thanks, - Joel > > > > The comments would be a good start. Just to take pity on people seeing > > the potential for concurrency and wondering how the concurrent accesses > > actually happen. ;-) > > > Sounds like you are kidding me :) > > -- > Vlad Rezki