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=-8.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 D2BB5C433E1 for ; Thu, 20 Aug 2020 21:45:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9E412075E for ; Thu, 20 Aug 2020 21:45:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lAHsE1M3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728757AbgHTVpa (ORCPT ); Thu, 20 Aug 2020 17:45:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbgHTVp3 (ORCPT ); Thu, 20 Aug 2020 17:45:29 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3796C061385; Thu, 20 Aug 2020 14:45:28 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id 185so3727541ljj.7; Thu, 20 Aug 2020 14:45:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QZOnv7vWdfjv3SqHEA46nQHDVbKjndfvS9Fptn5c3EE=; b=lAHsE1M3z56gY4Q01f/VtsJo8BTVYHuvYw9FurVaiCEvDgjhF2RqBPY9jc6I2xX9hc 6Y4AuxToEMZioijEfL6AzNbzf1iBjyD3n22+84o3gpj43ECPttL1qTIhSn/tTPfPoRD3 L91qSWhcnPYSPXOR9ePmDpgj9Taq8gewoiYomUTozjZT4xHjc6YNBgawbN49kZcDhUOU Szd0+BD5jRxO8aooUyA6pvkK0ZOoLOBBS4kcwgAWQlYWffi25Mih85FNvAECRpd+fMkm BvCF1pVI7K7PuK+0aH8zH8FkL+T7XkSQgjMksGQe7nhnVnTZuGn2uoi+rEs33pN8WAX6 wxsg== 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:user-agent; bh=QZOnv7vWdfjv3SqHEA46nQHDVbKjndfvS9Fptn5c3EE=; b=B9cBRwsT05QplP/5thb1K/wkqO2sqfTxkCOQr5aVaoVpG/9gue/dDQpvTb3v4RP/Rj ytXwFNOhp6Noj6EJwiUbpTT4zp1xUSWLr8KDt10KCi2RwS/oQ60keYqFS0TsUO0k3D+a aAgSOOGU2XeP1sqzAmbdCw6jwQwQvOOfXJ/FLx7Ge6DkfXF2PipQOfuUhh1aiu0/yN9K 8Bz4WN+bon0HuiSPPJxecKd6JBjlYdo32wLZt0PyoJnfgQdU+9goaq81Uh4ooROf2Pd7 U1k/lHP2L9uXJNWrEpFa6Re36VxBhApbZUB3VUrUIfEir+jZkqqPQn5RsN7aKw4aoUs2 6szQ== X-Gm-Message-State: AOAM533TOz7iMLofVrMVangapiiPo6ZZR+voXU8Z80NArsvROD3pzHtg Uw2WGfrYrYwDsidNeBgWEDY= X-Google-Smtp-Source: ABdhPJzPoxlP4SPY+LCj/KkElp/gHlvve5jFOm8dtSPmsQQY+NzL90YrPzmVQtcFyAMf8IbB3+gtOw== X-Received: by 2002:a2e:9003:: with SMTP id h3mr143345ljg.185.1597959926761; Thu, 20 Aug 2020 14:45:26 -0700 (PDT) Received: from grain.localdomain ([5.18.103.226]) by smtp.gmail.com with ESMTPSA id l24sm675558ljb.43.2020.08.20.14.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 14:45:25 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 03ECC1A0078; Fri, 21 Aug 2020 00:45:24 +0300 (MSK) Date: Fri, 21 Aug 2020 00:45:24 +0300 From: Cyrill Gorcunov To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, criu@openvz.org, bpf@vger.kernel.org, Linus Torvalds , Alexander Viro , Christian Brauner , Oleg Nesterov , Jann Horn , Kees Cook , Daniel =?iso-8859-1?Q?P=2E_Berrang=E9?= , Jeff Layton , Miklos Szeredi , Matthew Wilcox , "J. Bruce Fields" , Matthew Wilcox , Trond Myklebust , Chris Wright , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh Subject: Re: [PATCH 04/17] kcmp: In kcmp_epoll_target use fget_task Message-ID: <20200820214524.GS2074@grain> References: <87ft8l6ic3.fsf@x220.int.ebiederm.org> <20200817220425.9389-4-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200817220425.9389-4-ebiederm@xmission.com> User-Agent: Mutt/1.14.6 (2020-07-11) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 17, 2020 at 05:04:12PM -0500, Eric W. Biederman wrote: > Use the helper fget_task and simplify the code. > > As well as simplifying the code this removes one unnecessary increment of > struct files_struct. This unnecessary increment of files_struct.count can > result in exec unnecessarily unsharing files_struct and breaking posix > locks, and it can result in fget_light having to fallback to fget reducing > performance. > > Suggested-by: Oleg Nesterov > Signed-off-by: "Eric W. Biederman" Reviewed-by: Cyrill Gorcunov I really like this simplification!