From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C24DC18B0A for ; Tue, 18 Aug 2026 06:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787032972; cv=none; b=EeCUoxr1sgHOiU6J5297wC+OdiGKBv/7GkQdhabCvSnyJBl01UhWdGwf1XMzH1HnaabtpG0jsQlLE8Ywr4M3OkYAmM/2Z/Btiz+Q/lJ1dp0x4KznCARxjr+rJAUE3FBlrx1XXH1Lpk4GGuLcg1Vvyi93C3heUU3smegq7NHu3YM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787032972; c=relaxed/simple; bh=wzX1nnf3m2Gv5x0im2s26nctIc5VlXhrTdMZfkyHW7s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lvRmXFJg+MefL54c+TBYbLjjGK/YR1+KPT0/kEf3vCA9w8EDoMMHLbAlVzzc12oCMMY6ymaejrwDYwMmOoY2wmTxkiV88PJAbvErFR6ru23Aqi03rJGxr/Fgp6PZ9LukHZhv7ujRu/oxMXaCGQlXteZhsucjfN25TRgLSmWAtd4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=opauK5G3; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Fcg4lktQ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="opauK5G3"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Fcg4lktQ" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67I2YSmT3761995 for ; Tue, 18 Aug 2026 06:02:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= wzX1nnf3m2Gv5x0im2s26nctIc5VlXhrTdMZfkyHW7s=; b=opauK5G3rd3DyUOR SVuWPNMFrZieOh2MFUoDgyo+f9WI95Bdv8+BrJpLokBxUWy1IeZcQUSDXFP2ZHSN bUef76k5xPMs0ayUlxdmMLkt4QigyM37oApHpcKEZCvua2WP0PfigTBaQNAiWdzJ V6RNyTgvDxHfsQSDZkTDERe1WLcSFPTpY7dkxWJYsKGVjc9IQoczfJ4ABn/vFZBW 48BxcFEtX84Xis0Tl9K9AZ15FEA/m+W9w4R6JTvTLNJdllzb49A3cIkrsHhYvt1m lLKgNodhMgjgqFBZg9dziDnVvtoz2VJkB504LtNG/Ow9CNWGxEoI09q9ROvIpCqw R6bufQ== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g4eqtrsge-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 18 Aug 2026 06:02:49 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2cee894b3d8so82533255ad.2 for ; Mon, 17 Aug 2026 23:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1787032968; x=1787637768; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from:references :cc:to:subject:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to:content-type; bh=wzX1nnf3m2Gv5x0im2s26nctIc5VlXhrTdMZfkyHW7s=; b=Fcg4lktQPvSbqGAH5lQImkF3+qTZYcU7386MRCBZcrwJVEzO4mbStmDJ3Ouf/vbwjL 3i+QIFf1DSLxrrMBO+izGJxUxsAUXj6tscYfzJDj3ER6EGn5rNdWklz66tT6D16qksIT 3h+et7GAnLl7RTCcepIgzjT/lVNhrXfHrVIEeoXFWQ4baJpd69yS3Unol/0VNPXkZgvm f8/A+3uKZICoyAjipObesPZAaDtbU7PXC8JNqIa+Ge0A3OZCW1sjmCGIEantdh3P7A+z mhGEn8WJnQz3gyDd1nSxEP4bz0j82BiLnrGhhnjqAXk4T1irXPwY5TLgKOqo3xgYqaOi zykg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787032968; x=1787637768; h=content-transfer-encoding:content-type:in-reply-to:from:references :cc:to:subject:user-agent:mime-version:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wzX1nnf3m2Gv5x0im2s26nctIc5VlXhrTdMZfkyHW7s=; b=cgGYETYQfJWlzL4ZQvTZ4zghDdZbjTb2vL7zRuDyZTfDKet34mCH0mR9fU9O481dsm vqJfcysO6HaygD9HVBZDHlOnnodkQfrN2CA+iG8bpkfEVQAGlCdbY+ToQJXKhN8uS1nq IUyahNCr6w6sighQgpsBAsJCsrtyB4OKjIIIipdvrOUobBZhirS975vGghG5DokdFsWY FH1Ho/UssXiQXcVuI0e/61/An8rD9udUN7S9WYaOemmYFZ+VNS1i5FkfdcyT6aHDjJH6 eZ1q7gw3lxSexsP8CaKf8J3StC7I06MdHlHFzjTbsBfZlMPZ4PY5Sh2pEufPnfL+kgcf MmAA== X-Forwarded-Encrypted: i=1; AHgh+RquFnRUxlJIG5Ce79Yj9E4eSFX4eCF/Got8NfQQrfydCDhjCMcr0Q3s8z4m3L0h5Z+GL0IMCjyqAs3JUZ8=@vger.kernel.org X-Gm-Message-State: AOJu0YxxXxjz/q2yGVbNQrgBSI7y6Wwl1nOrGLzTtYTcZxPIi5R0AYMe TLKJr+mjF6vLPGtwvDwQDqk9gw3REuUlOLalV2xRpmUlCtQ0Cbl/WnWXJwEPwL/JAsoywv9J9c6 HDrdeoNdAuKdUW43BlLObVhvu2A6eph2bqCaBfKuZ4IfnfjluiiMfnxLK0OsDAiqWih4= X-Gm-Gg: AR+sD13cSaWajdLeiA64CoABGJW5adOBuIp3Tdv3dBCJh8+faXSHVF7ObEl8El2pb1P WNKBosCGU9ajLwndyyXpYEaj9xswQvBtZ0/iTTmuEu8155D9MSPZJ51Zf7gXG5zHlg072SuyjWm 0+uHQU3ZRI5qbkdzsrdiV8ifVoatxGL0cGB36yuoL+gYuixRgi709N5ayFh20c/vgqY+IZHfzZv MgwYu6aSxM9sdqqBiF969Wb/ZhJESiLBkh0RgyB5cOwjSYrToSLK0/LpjGmTtSO+wVr2AJQwTQ5 3mu0aIIm/SCEZW2rPkw7cLOajWBXN29tdIvLH0dBduEJjPueRQIodFPTC1pBHB7yhIut7+DwDAI d93WsxV0TF2peq5L7avYhoz8= X-Received: by 2002:a17:902:d4c4:b0:2d1:1a18:4d0a with SMTP id d9443c01a7336-2d3b0874a8bmr293429535ad.9.1787032968365; Mon, 17 Aug 2026 23:02:48 -0700 (PDT) X-Received: by 2002:a17:902:d4c4:b0:2d1:1a18:4d0a with SMTP id d9443c01a7336-2d3b0874a8bmr293428755ad.9.1787032967818; Mon, 17 Aug 2026 23:02:47 -0700 (PDT) Received: from [10.239.97.207] ([114.94.8.21]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d5bb499e12sm13421565ad.8.2026.08.17.23.02.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Aug 2026 23:02:47 -0700 (PDT) Message-ID: <066081a1-e644-4b01-86c5-e5ab908a7754@oss.qualcomm.com> Date: Tue, 18 Aug 2026 14:02:43 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] tty: n_tty: use kvzalloc/kvfree for line discipline data To: Greg KH Cc: jirislaby@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, liulzhao@qti.qualcomm.com, cheng.jiang@oss.qualcomm.com References: <20260817135526.386863-1-xin.chen2@oss.qualcomm.com> <2026081706-tricky-slicing-166f@gregkh> <2026081747-secret-partly-158a@gregkh> From: Xin Chen In-Reply-To: <2026081747-secret-partly-158a@gregkh> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Info: AW1haW4tMjYwODE4MDA0MyBTYWx0ZWRfX7yACkCBG+ExZ 2DPHmtsv1w5y6lVgiIr5xIuAu3oLHvJJAPbt99pDQkPheUHUANopE5irl2ElfbBy4pEmba5W13e FXWJn5u+OBGMOes+gCQFTC2oPklWKWc= X-Proofpoint-ORIG-GUID: O-ylmhEUr0iljwF1IEKbY412-BRND79v X-Authority-Analysis: v=2.4 cv=UfFhjqSN c=1 sm=1 tr=0 ts=6a83f589 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=Uz3yg00KUFJ2y2WijEJ4bw==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=VwQbUJbxAAAA:8 a=rJFLmW8hIwzoBhnFJRUA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-GUID: O-ylmhEUr0iljwF1IEKbY412-BRND79v X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODE4MDA0MyBTYWx0ZWRfXz+TDK35SnWLW QJITV7aZECdpHNRA1BGSSD3WWx+ThJuxEsc0g4IcgNoqcipEmYMtL/VoSdSXR6b4k0yRIPG4337 BV7b/EErSrpgzuBWwKh5UrJCBA7MSBSCzOWJR/quV7nexH2M2dIomCQGbd9Ji+1FKK5VjYRBdBY GPVz5WX7/PYyd5gsWbFYG4HXc13BZUJUtdw+BB92J9UGLZK7GxIXRP1X2iZMusoMdb4NB2DuAcu BrvYsk6Eooq+sucAsleFvxzVmQni/B3EvlaPhy5IABRo5pkjwCvVryOkuKEEyUW3QAEm4X0u5sA s+9oGRJ3Q3BAHcuANEmb3ZmTei4zmaazOpvfKliPgM5gTLz4RA4RWfsVJt24DHoOeG+A8obZjfW 69BKzPlWYSJypt1VZ6JURxPD+IJ6xj4GFTmRwdsAPBgTasggZd10+KvgMyJogN1PlVe73l4lnpd OZQJmYcOU2Q2f1c3yVw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-17_04,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 impostorscore=0 suspectscore=0 adultscore=0 spamscore=0 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608180043 On Mon, Aug 17, 2026, Greg KH wrote: > Also, you are papering over the real problem here.  If this one > allocation is failing, what keeps the next one from failing and then > the skb will not be able to be allocated? The key difference is allocation size and allocator behavior. vzalloc() always allocates page-by-page from the buddy order-0 free list, so two back-to-back vzalloc() calls for ~10 KB each consume ~5 order-0 pages each, transiently depleting the order-0 free list. kvzalloc() serves the same ~10 KB from the kmalloc-16384 slab, which is backed by order-2 compound pages — a completely separate pool from the order-0 pages that skb_clone(GFP_KERNEL) needs. So switching to kvzalloc() eliminates the interference between n_tty_open() and skb_clone(). > Why is the system so out of memory in this slab that this is > happening?  What changed in the tty layer to cause this?  Or did it > happen elsewhere? Nothing changed recently in the tty layer. vzalloc() has been used here since commit ebec3f8f5271 ("n_tty: Access echo_* variables carefully.", 2018), which replaced vmalloc() with vzalloc(). The issue surfaces only when serdev_device_open() is called multiple times in quick succession (as happens during BT UART transport init), triggering multiple n_tty_open() calls back-to-back. Each vzalloc() drains order-0 pages, and the window where skb_clone() fails is narrow but reproducible under this specific pattern. It was found during a BT enable-disable sanity test that repeatedly cycles BT on and off, which consistently triggers the back-to-back n_tty_open() calls that expose the issue. > And no cc: stable or Fixes: tag? Both will be added in v2:   Fixes: ebec3f8f5271 ("n_tty: Access echo_* variables carefully.")   Cc: stable@vger.kernel.org Thanks, Xin Chen