Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2318434pxb; Mon, 20 Sep 2021 18:40:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzC5E92wK/IaIDi/ID9vwKWx88ccoeMKd5T2slx+DIdFaaHji5Q0aEO7ADyoMjRVoKaPIzh X-Received: by 2002:a05:6638:1606:: with SMTP id x6mr15309199jas.59.1632188434023; Mon, 20 Sep 2021 18:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188434; cv=none; d=google.com; s=arc-20160816; b=WvyTZd018XxyxALQzwRzgAieqZmrwhthMRzFfrmzYLEFh0S2Je0AY2wkRZobH+3b9d /u9yL54MjYagGAW033b/1wfkA/xflGwaO8244VqD8zjHIZiy6E8zFP/S7hDB0QSFEbhv 94Y5d/byWHz0jrNAWsJs7mocFKb5vg0ZDoCaJGRp7E7unkKWPf4+ntyloF3zXDhEAD5W bmYE5GfMIsGE0OolZBpQ5PdBpD94kaFBaXfEPwGqrjGqE4/Ci23toWhKHCPsAr6POpTx magpbTokFfBjFdpM1M6X3NYZ7CnzyDK3fRcanlltL//lG5pM+vSJ1HYvsP4D4RAo6gfB NeMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=YVcspMNftAsxUFRvxnT+9Gw5sEXFW56A4jnlNsbowNE=; b=inGKQ2LzwQm2AVDkIfKYzZFaUUoavYEKT4gd9OKIhWE+LH2H0YCXXDFfUxhbKzjtjW ovY3QnmatooTlWoj6StCF9t6gyK8Rjds+p98uApKeyinCrtz8i3XHK8uf/bNcoQqbgsa uSJbpubf3RZ9JhEZ37AqDGXOMNkZ/HWbBFFvDznNJg2SXpKQO/ITBuvUfDgDx+FYX9dE 3FwX3lfHaby88Hu0VCF3+b88TKatpi2T00DUlyOeyo6sVgSSxj7QIN3fdtIiBL4lVaAC Ybr9q0AylY4xk9+xbcykOleNlpTNjXN1J+7kxTDu6zaYTPl+towFFbsu9vtQzyEt3RBb GxqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ejfq6rlR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si9222508jam.54.2021.09.20.18.40.22; Mon, 20 Sep 2021 18:40:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ejfq6rlR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232372AbhITQes (ORCPT + 99 others); Mon, 20 Sep 2021 12:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbhITQes (ORCPT ); Mon, 20 Sep 2021 12:34:48 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D78AC061574; Mon, 20 Sep 2021 09:33:21 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id mv7-20020a17090b198700b0019c843e7233so366898pjb.4; Mon, 20 Sep 2021 09:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=YVcspMNftAsxUFRvxnT+9Gw5sEXFW56A4jnlNsbowNE=; b=Ejfq6rlRJmiwgpL+WjIgdKHbBRpViduhVUDS5G+DOeMixkPZJppAI2ObsEuCDNb4xC Zh4Lk+TjiMNMdAydUm1wbY2hAM4NwYAdZwzVyRfwE6LEWoJh2oP307qKYhyvtbxQWBf2 TYgIGfbsCyf51B72IiJmOCGgpulhdc3IQgLCC2HqIm2HTzAEy0EnsIgNSEvp4Ji5lvSj 3dPkC8qJvLaeGBJJZMSeNcTG/eDDqFjc2pMEe62AouApgBc5vrsuHS2MgyNGqsYzbKni KW8zS6I7iuUO364KMgjgailkHE1Vrnhhr1mOCX72tKOFbi/5LQpHO1pPWJc+OW99iG8t jH+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=YVcspMNftAsxUFRvxnT+9Gw5sEXFW56A4jnlNsbowNE=; b=U1mq5H2lZShFwDs+Id5zBnWJQ5aBMfpsgEQxIm/43BhZso1yc1ihe3OFb6gS0PkFXn Nef8OLzPTjbqQDQKi+AYgGeVukr0T2effjoV+/uR3/qgvmJ4VLPcGUxbHNXctu+//z2d 90aOcQF5UxI2OMvVFYpUVPm7xjv694IViOIXL8iR8dVtoMLEvm+0Y9usDUQJjIi01y2I rA21xfsR9I7UoRYwrtFMJnVxMsPP666mjvFlsfVix8BBoIJUFn4JWxQ6H0C5aHfEh/09 w53x52NDPEFFyrVg34XKlht+UoExMX/rb+MroUZjtbrX7jkkKFIWA4bag34W+nJMGz+F grSg== X-Gm-Message-State: AOAM531tBSSCkN2pJ/M1/1nUn2tpLZb8XJJN8sDApHOR9pGnxdLtJ3dR t0+bhbA7NtSff41trfRV3islpfVnjXUJ8Q3NA4dz5fad X-Received: by 2002:a17:902:e282:b0:13a:45b7:d2cd with SMTP id o2-20020a170902e28200b0013a45b7d2cdmr23507984plc.86.1632155600523; Mon, 20 Sep 2021 09:33:20 -0700 (PDT) MIME-Version: 1.0 References: <20210916122943.19849-1-yajun.deng@linux.dev> <20210917183311.2db5f332@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <87275ec67ed69d077e0265bc01acd8a2@linux.dev> <202109202028152977817@linux.dev> In-Reply-To: <202109202028152977817@linux.dev> From: Cong Wang Date: Mon, 20 Sep 2021 09:33:09 -0700 Message-ID: Subject: Re: Re: [PATCH net-next] net: socket: add the case sock_no_xxx support To: "yajun.deng@linux.dev" Cc: kuba , davem , netdev , linux-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 20, 2021 at 5:28 AM yajun.deng@linux.dev wrote: > > From: Cong Wang > Date: 2021-09-20 07:52 > To: Yajun Deng > CC: Jakub Kicinski; David Miller; Linux Kernel Network Developers; LKML > Subject: Re: [PATCH net-next] net: socket: add the case sock_no_xxx suppo= rt > On Sat, Sep 18, 2021 at 5:11 AM wrote: > > > > September 18, 2021 9:33 AM, "Jakub Kicinski" wrote: > > > > > On Thu, 16 Sep 2021 20:29:43 +0800 Yajun Deng wrote: > > > > > >> Those sock_no_{mmap, socketpair, listen, accept, connect, shutdown, > > >> sendpage} functions are used many times in struct proto_ops, but the= y are > > >> meaningless. So we can add them support in socket and delete them in= struct > > >> proto_ops. > > > > > > So the reason to do this is.. what exactly? > > > > > > Removing a couple empty helpers (which is not even part of this patch= )? > > > > > > I'm not sold, sorry. > > > > When we define a struct proto_ops xxx, we only need to assign meaningfu= l member variables that we need. > > Those {mmap, socketpair, listen, accept, connect, shutdown, sendpage} m= embers we don't need assign > > it if we don't need. We just need do once in socket, not in every struc= t proto_ops. > > > > These members are assigned meaningless values far more often than meani= ngful ones, so this patch I used likely(!!sock->ops->xxx) for this case. Th= is is the reason why I send this patch. > > But you end up adding more code: > > 1 file changed, 58 insertions(+), 13 deletions(-) > > Yes=EF=BC=8CThis would add more code, but this is at the cost of reducing= other codes. At the same time, the code will only run likely(!sock->ops->= xxx) in most cases. Don=E2=80=99t you think that this kind of meaningless = thing shouldn=E2=80=99t be done by socket? I have no idea why you call it reducing code while adding 45 lines of code. So this does not make sense to me. Thanks.