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=DKIMWL_WL_HIGH,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 4B842C11D24 for ; Thu, 20 Feb 2020 22:33:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21110206F4 for ; Thu, 20 Feb 2020 22:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582238014; bh=mzPiCbr8XYsvkRVHCAOzgYnZ6/GsVqT7alkkqsg2qmQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=XceU8iuXX+d7G/oZczh9BopbYaGc/XBfJfkJYRfKJCUN78Dtk6ryHoZavsTid8ASf kKYqt3wY5VysUC4aAj+1zzFjeXpNzRQr4+6dQnKabmrhN7So3k/WStZOlmeS2L9lpm nKmkxq1wcSKHTpONO3HODXOZBW/DwXYj1JJRHmlY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729267AbgBTWdc (ORCPT ); Thu, 20 Feb 2020 17:33:32 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:45841 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729222AbgBTWdc (ORCPT ); Thu, 20 Feb 2020 17:33:32 -0500 Received: by mail-lf1-f65.google.com with SMTP id z5so4368698lfd.12 for ; Thu, 20 Feb 2020 14:33:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WrNmlOpMVxzFXh2A2oJzXRWZK2fGDe1+SPIAN4gWybk=; b=QiMLUGsRq9HWg+G+gXiEaS3g8vcEPOTXS0nkdYQXIsCA2EjphiI1+TGu1HVJ3od+BY 4nIUXqbNSwvfL1zzmPatevn6ccupRjp+aZGa5eL8bOeMqUiv7Bg7Hz5IKilERFOA99sS jMLLQ3OrRmjEMgFi9TJzZnDfd0rXWYetgu1bs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WrNmlOpMVxzFXh2A2oJzXRWZK2fGDe1+SPIAN4gWybk=; b=qdlkAtqv0QPRFcgCw2GGLTy1BAv1ZF1UKkfHaULKeCH9uXxRqBUlj8RCaiiHji7P5W 8+M0zCDV/1947+gUcJp2C5OUC4wLHt6qbBgegspQlj1wupZ5m4HQ12HcS+Kgmd3bGHKJ 7mIS3/dKl4jKvOeojdIVm4rCwYVrDG0EheHsxcqta6L8rLdDYgrSHzrlfAiAokkKWzmX bRrPATIL5GyfzSnReCnQHHhtKfzgXsZ6j65T07w6N3HcUOiVifI9ZjTDcFLjBGUNjnkj Ze1fc0tcq/PN0gBd5mlGSfX+hRqoPyqDk+q7iEktQhNINOk/sJ0LvIeQjlbNLIEIjUGR LWuw== X-Gm-Message-State: APjAAAXqY7r+d5GTAzgBnsucdYA/3fhOIIJ+yGr5hzTW0qw280AEU1rl cpi47YP+ENTqT28DuRK+fRxaRg7dTRw= X-Google-Smtp-Source: APXvYqyt4ev1xCkzN6l7zK6LvnI5nBt78AouGTLndT3ksKugbBtvZdBRcaApDsmbMXoytNsvDhomXg== X-Received: by 2002:a19:550d:: with SMTP id n13mr18193328lfe.48.1582238008366; Thu, 20 Feb 2020 14:33:28 -0800 (PST) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id d22sm466754lfi.49.2020.02.20.14.33.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Feb 2020 14:33:27 -0800 (PST) Received: by mail-lj1-f176.google.com with SMTP id n18so138927ljo.7 for ; Thu, 20 Feb 2020 14:33:26 -0800 (PST) X-Received: by 2002:a2e:97cc:: with SMTP id m12mr19716647ljj.241.1582238006401; Thu, 20 Feb 2020 14:33:26 -0800 (PST) MIME-Version: 1.0 References: <20200210150519.538333-8-gladkov.alexey@gmail.com> <87v9odlxbr.fsf@x220.int.ebiederm.org> <20200212144921.sykucj4mekcziicz@comp-core-i7-2640m-0182e6> <87tv3vkg1a.fsf@x220.int.ebiederm.org> <87v9obipk9.fsf@x220.int.ebiederm.org> <20200212200335.GO23230@ZenIV.linux.org.uk> <20200212203833.GQ23230@ZenIV.linux.org.uk> <20200212204124.GR23230@ZenIV.linux.org.uk> <87lfp7h422.fsf@x220.int.ebiederm.org> <87pnejf6fz.fsf@x220.int.ebiederm.org> <871rqpaswu.fsf_-_@x220.int.ebiederm.org> <87h7zl9e7u.fsf_-_@x220.int.ebiederm.org> In-Reply-To: <87h7zl9e7u.fsf_-_@x220.int.ebiederm.org> From: Linus Torvalds Date: Thu, 20 Feb 2020 14:33:10 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/7] proc: Mov rcu_read_(lock|unlock) in proc_prune_siblings_dcache To: "Eric W. Biederman" Cc: Al Viro , LKML , Kernel Hardening , Linux API , Linux FS Devel , Linux Security Module , Akinobu Mita , Alexey Dobriyan , Andrew Morton , Andy Lutomirski , Daniel Micay , Djalal Harouni , "Dmitry V . Levin" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Kees Cook , Oleg Nesterov , Solar Designer Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Feb 20, 2020 at 12:51 PM Eric W. Biederman wrote: > > Don't make it look like rcu_read_lock is held over the entire loop > instead just take the rcu_read_lock over the part of the loop that > matters. This makes the intent of the code a little clearer. No, this is horrid. Maybe it makes the intent clearer, but it also causes that "continue" case to unlock and relock immediately. And maybe that case never triggers, and that's ok. But then it needs a big comment about it. Linus