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=-9.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 5D1DCC3B18F for ; Fri, 14 Feb 2020 00:59:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 034D120848 for ; Fri, 14 Feb 2020 00:59:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UgvQLtGA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 034D120848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6F2256B05CA; Thu, 13 Feb 2020 19:59:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A2F76B05CB; Thu, 13 Feb 2020 19:59:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 592C06B05CC; Thu, 13 Feb 2020 19:59:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 3D8C06B05CA for ; Thu, 13 Feb 2020 19:59:35 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E9C92824805A for ; Fri, 14 Feb 2020 00:59:34 +0000 (UTC) X-FDA: 76486924668.19.cows90_8dd20982f3e13 X-HE-Tag: cows90_8dd20982f3e13 X-Filterd-Recvd-Size: 4063 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 14 Feb 2020 00:59:34 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id z7so4046181pgk.7 for ; Thu, 13 Feb 2020 16:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=varpYZ4e9HN4fOkt9AtUu2Zz+YP3IR3moNk2yDZcybk=; b=UgvQLtGAB7MtuSvb5VW5iX6JP4xMoRNI1OFPG2iOs+jBYmJ+WbXDLlC4AjJiw9wCv0 F+sqYSnaOv8wS1gVLx325xQ4ryuIrHQ+2jyPELmBAqwHTgtsnX5rdCJVJ8/inT6Vi81l O+bZNZ2gn6fq/dtslTf7kEKAONzoRa30zdfjs9JMzix9yP0WsrRw6bk0ZiCqdtKTZ4qg USl12yzLNmB1Y9U4NqiQI6DtrC2ulOFYhSjsJWL8BGxtdxsO5vexuc0ug5C7GRfwq5bE sL+zf0Lx82VBMzHwEpo6sRl8R/fuE1E1IIYhgyjdmMhc1X4s4zhz9T6dJzcRJEl6ZoS/ Q6ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=varpYZ4e9HN4fOkt9AtUu2Zz+YP3IR3moNk2yDZcybk=; b=umBIMTbFPMsrb+S9WaOezkJawuSqwGcteJi9W90QgI/66uDQiYoWNNgwlpk1BDwHOU 8r0AEkg2DHBj0mAFjUOhioutSPQ/DR1H9M8dZfb9ceR3Tq2DmZ1+Bk8T2cpAXK3sllQX zlzuI1D6F7/+TxCt6RzVnJPPXb/X1LGbsPklyKVVA1arDqjZJ9lIsllQDlLhvPkDtl1X lgX9FQgOukTjM5E9N5ZktPwZry8gBOzEZlHWifIe4V9QM+6+KPHC9tHbO0pTf+jb8uVa 3UbJh1gnbL2yTDfHSHRtDWnq2pGKI2nMcJ+AhUah9tD1fDJPe2ngmq5JI4Ede4GGIyFS SEbw== X-Gm-Message-State: APjAAAXJmbSxK4AwZCASxpAZexKsaC8TH0bMNj90wdK7ZwtdaaCbMu73 0Cal1YdK+uqqHr4QiztbQLk= X-Google-Smtp-Source: APXvYqwyr+txoEK8I+6o4JJ357eA8FoNm7+oeZf4aoBqqZq7gyiUnYPml18ZWdiN7zEcdkSoova6Tg== X-Received: by 2002:a62:8e0a:: with SMTP id k10mr636956pfe.49.1581641973348; Thu, 13 Feb 2020 16:59:33 -0800 (PST) Received: from phantasmagoria.svl.corp.google.com ([2620:15c:2c4:201:2b0a:8c1:6a84:1aa0]) by smtp.gmail.com with ESMTPSA id e6sm4412759pfh.32.2020.02.13.16.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 16:59:32 -0800 (PST) From: Arjun Roy To: davem@davemloft.net, netdev@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org Cc: arjunroy@google.com, soheil@google.com, edumazet@google.com Subject: [PATCH mm, next-next] Add missing page_count() check to vm_insert_pages(). Date: Thu, 13 Feb 2020 16:59:29 -0800 Message-Id: <20200214005929.104481-1-arjunroy.kdev@gmail.com> X-Mailer: git-send-email 2.25.0.265.gbab2e86ba0-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000023, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Arjun Roy Add missing page_count() check to vm_insert_pages(), specifically inside insert_page_in_batch_locked(). This was accidentally forgotten in the original patchset. See: https://marc.info/?l=3Dlinux-mm&m=3D158156166403807&w=3D2 The intention of this patch-set is to reduce atomic ops for tcp zerocopy receives, which normally hits the same spinlock multiple times consecutively. Signed-off-by: Arjun Roy --- mm/memory.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index f1d5f2264aef..3b4007a6ef7f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1463,8 +1463,11 @@ static int insert_page_into_pte_locked(struct mm_s= truct *mm, pte_t *pte, static int insert_page_in_batch_locked(struct mm_struct *mm, pmd_t *pmd, unsigned long addr, struct page *page, pgprot_t prot) { - const int err =3D validate_page_before_insert(page); + int err; =20 + if (!page_count(page)) + return -EINVAL; + err =3D validate_page_before_insert(page); return err ? err : insert_page_into_pte_locked( mm, pte_offset_map(pmd, addr), addr, page, prot); } --=20 2.25.0.265.gbab2e86ba0-goog