From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752718AbbCXKbi (ORCPT ); Tue, 24 Mar 2015 06:31:38 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:35579 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752148AbbCXKbh (ORCPT ); Tue, 24 Mar 2015 06:31:37 -0400 Message-ID: <55113D05.9070401@gmail.com> Date: Tue, 24 Mar 2015 11:31:33 +0100 From: Patrick Marlier User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: "Paul E. McKenney" , Josh Triplett , Arnd Bergmann Subject: [PATCH 0/3] rculist: Fix list_entry_rcu to read ptr with, rcu_dereference_raw Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul and Josh, While running some benchmarks with rcu, I noticed that rculist had a performance issue compared to the non-rcu list. Having a closer look at the rlulist, I found that there is a bad usage of rcu_dereference_raw in list_entry_rcu(). Indeed, "typeof (*ptr) *__ptr = ptr;" reads ptr and "rcu_dereference_raw(__ptr)" forces read on the stack variable __ptr. However, ptr should be read with rcu_dereference_raw not the __ptr. This was introduced some years ago with commit 67bdbffd (2010-02-25). I am proposing to revert this part of the patch but probably this can be fixed differently. Fixing this showed 2 problems in the usage of list_entry_rcu. Since it touches other parts of kernel, I guess it requires ack from other maintainers. Thanks. PS: I will Cc the others maintainers when somebody confirms the problem. Signed-off-by: Patrick Marlier Cc: "Paul E. McKenney" Cc: Josh Triplett Cc: Arnd Bergmann