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.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 25317C3B18C for ; Thu, 13 Feb 2020 17:09:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DD1A7206ED for ; Thu, 13 Feb 2020 17:09:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="s2Y18twm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD1A7206ED Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B606B6B0588; Thu, 13 Feb 2020 12:09:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B11376B0589; Thu, 13 Feb 2020 12:09:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A4E8E6B058A; Thu, 13 Feb 2020 12:09:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id 8C6136B0588 for ; Thu, 13 Feb 2020 12:09:27 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 38300A8CF for ; Thu, 13 Feb 2020 17:09:27 +0000 (UTC) X-FDA: 76485739974.20.need55_6f8efb14ff060 X-HE-Tag: need55_6f8efb14ff060 X-Filterd-Recvd-Size: 5087 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Feb 2020 17:09:26 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id m16so7599413wrx.11 for ; Thu, 13 Feb 2020 09:09:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UMbYCpdCH8T8sVuZfzcA/ngmQLlMH6y8DegWbJdKko4=; b=s2Y18twm33EPAUcSQxsxInq8a0dds4VggPNveAoz+VMUepMzWVnWWR7YEpDzXQYs1y lRhqpN5ffmjp89a+EFWY0St2RG0pE35PGKEFvcWjbCQ1lLRqz3CG0BWlVvZIrf9gjPLn GQ93N6ZnSlrB2X6gwDPp5WBGrLCKtld8mpQzlXOd/RnrRSBBfLWspmp/UGAp4wFWbAms LY5F7xkRay4VRrzzM3jSUm3OzzrXNLzouaaSi3NTyQ1gKx4stAdquMEt1cfazL5R61oQ pbcM4qyWGeUjHq8YzSp1NfJowdpVWy4cYrB1D2+E9dnLF2SxtUCn/WMIuy+Rbhlvh+ju okBw== 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=UMbYCpdCH8T8sVuZfzcA/ngmQLlMH6y8DegWbJdKko4=; b=ASpTMXHEbBeCKbmjRaboi2S7W8YoYilc6g4bdcwdJ0h0LS9yXE4FKv1Y2yugM6lcDT /aaOEga+CJHts3ZJiOjHxia6kZ8PUpH6FjIcd8zN2ic7gG+BBZUg6g2iSmiY+Z1/vCDw GkMvaKK6QmOAfnlNYJDcfQbqDzv0y+BqsEZXK8EN+HXwseNyw0FSFaeLjJ8TaZlwkDt8 K998mP70Ijs5ppefdyR0qDoJvX/b3Tm32QSZuRjpCqL+jTdCcXd2tiYy1o92BvS1roY2 KwRxc/9XphieTP7HR7GgggJcI/jMz/HMX0MIdoMFK+IGRsNb+T5MPcerF/BtUPqAcNpU kYjw== X-Gm-Message-State: APjAAAU1mGDk553QF7pLmox0Yz3q5oFN6k/omCVyWtmKFLJ0KsK1VL1N Ttmz0DEgElfRhdyoX8MPsBop6UZ+og/dJAjwMeE1ag== X-Google-Smtp-Source: APXvYqysk4BQRUA7KMjIf3XEDQQsUviietYjVkLfWfBQqDWTKRzgbIjzZ6YU2odsXwNwn76mVKONYWxTwrbLQmqJR5Y= X-Received: by 2002:a5d:6545:: with SMTP id z5mr22318536wrv.3.1581613764978; Thu, 13 Feb 2020 09:09:24 -0800 (PST) MIME-Version: 1.0 References: <20200128025958.43490-1-arjunroy.kdev@gmail.com> <20200128025958.43490-2-arjunroy.kdev@gmail.com> <20200212184101.b8551710bd19c8216d62290d@linux-foundation.org> In-Reply-To: <20200212184101.b8551710bd19c8216d62290d@linux-foundation.org> From: Arjun Roy Date: Thu, 13 Feb 2020 09:09:13 -0800 Message-ID: Subject: Re: [PATCH resend mm,net-next 2/3] mm: Add vm_insert_pages(). To: Andrew Morton Cc: Arjun Roy , davem@davemloft.net, netdev@vger.kernel.org, linux-mm@kvack.org, Eric Dumazet , Soheil Hassas Yeganeh , Linus Torvalds Content-Type: text/plain; charset="UTF-8" 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: I think at least to start it probably makes sense to keep regular vm_insert_page() around - smaller stack used, less branches, if you know you just need one page - not sure if gcc would err towards smaller binary or not when compiling. Regarding the page_count() check - as far as I can tell that's just checking to make sure that at least *someone* has a reference to the page before inserting it; in the zerocopy case we most definitely do but I guess a bad caller could call it with a bad page argument and this would guard against that. Actually, I appear to have fat fingered it - I intended for this check to be in there but seem to have forgotten (per the comment "/* Defer page refcount checking till we're about to map that page. */" but with no actual check). So that check should go inside insert_page_in_batch_locked(), right before the validate_page_before_insert() check. I'll send an updated fixup diff shortly. -Arjun On Wed, Feb 12, 2020 at 6:41 PM Andrew Morton wrote: > > On Mon, 27 Jan 2020 18:59:57 -0800 Arjun Roy wrote: > > > Add the ability to insert multiple pages at once to a user VM with > > lower PTE spinlock operations. > > > > The intention of this patch-set is to reduce atomic ops for > > tcp zerocopy receives, which normally hits the same spinlock multiple > > times consecutively. > > Seems sensible, thanks. Some other vm_insert_page() callers might want > to know about this, but I can't immediately spot any which appear to be > high bandwidth. > > Is there much point in keeping the vm_insert_page() implementation > around? Replace it with > > static inline int > vm_insert_page(struct vm_area_struct *vma, unsigned long addr, > struct page *page) > { > return vm_insert_pages(vma, addr, &page, 1); > } > > ? > > Also, vm_insert_page() does > > if (!page_count(page)) > return -EINVAL; > > and this was not carried over into vm_insert_pages(). How come? > > I don't know what that test does - it was added by Linus in the > original commit a145dd411eb28c83. It's only been 15 years so I'm sure > he remembers ;)