Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp80451rdb; Wed, 20 Dec 2023 06:53:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIYrn2XFLvU4wzL+i4a6iQl2WtmFTwzAFkwE3zcwAl4WDx6g6IoaRBEBEEuVw+0Qw/2Nps X-Received: by 2002:a05:6871:79f:b0:1fb:75a:6d25 with SMTP id o31-20020a056871079f00b001fb075a6d25mr22923665oap.76.1703084003560; Wed, 20 Dec 2023 06:53:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703084003; cv=none; d=google.com; s=arc-20160816; b=lCva0FWD33xopB8VWWtSiuvcCTbnBFiAxWrm7RF5RgiXL0bRBgb8M+CEJ5waOtisOY Pb4BTT4smQKXCeapb+E9rmFSDFxRXWPQi4e7JWivAouxu8+R9YmNZ3X/f81mZcUuczFX 36zcYqPJTQWH0y0JnyQxwqVwlobHy3Vdd7jAUPTqMEHU3Z8cXB/5Ve750t6HKEux/iNo 5Lpzr2cttoh05BB0Z8Kq06mLDW5FdQ4/5OkfrwoT8KB1p6QRIiB1y/fqWGcux14l2GTv JXKL7iPDTxWLHAEedBuKBs5LKKd4BfLCFSHDiGtC6OAkjcXca5gvvXkGQv/j02ucIdbG Umsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eBS/M67eqFyB1dRDgBWV3AQl//bHp4H9z6F6Hon/YZM=; fh=w3yeO0Q+7yApRIBQ5jppSTwFcTlt1VKBrJmqR4dAHYY=; b=eLbqj5zP+WFymQxcKaVpSq8M8KRokGAW8ZHBgjlBt1BvPZ7RWTLzANgyqBO+MD/Pqk pjx5mHvqJX4d5Az90lFPE0El9gj2ySv/Yo2Pd2o6d9gn+PNdqsVYvnR76MkhZvlbH/W7 /v2n7NLkGrHtd4H+AYLcPMt+IxrtoPNuOuUnW8lXcFd+5JsYuEouIzzWfLqFH2AJ4WeX 7kOmZJMPrEL2bRkz+7n1fFe6M/gE+J7Q3qiwvbWrzv5j8RJbiGmoADXnQoRvfxjlH8Nu 9ktDnTUk7S47jtUi0pZ5wjrrdZ0Z+ErG4cekrDqXVTSRArobREKkWG3F2b0aMeC/m2aa 5CsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Wg483YHl; spf=pass (google.com: domain of linux-kernel+bounces-7090-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7090-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y18-20020a634b12000000b005c65ed0f692si21761236pga.141.2023.12.20.06.53.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:53:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7090-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Wg483YHl; spf=pass (google.com: domain of linux-kernel+bounces-7090-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7090-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 22FC12868F3 for ; Wed, 20 Dec 2023 14:53:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E31D33D995; Wed, 20 Dec 2023 14:53:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Wg483YHl" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0765D3D979; Wed, 20 Dec 2023 14:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-5c6ce4dffb5so2061882a12.0; Wed, 20 Dec 2023 06:53:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703083992; x=1703688792; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eBS/M67eqFyB1dRDgBWV3AQl//bHp4H9z6F6Hon/YZM=; b=Wg483YHlO5WZt/L61/Ku6GShhIqB/biaiQIt2VG9gUG202KSJKUGyoUYQE4ORPKnrW VhDeHPEKuffZVXKXF1cGTFNy+fk0KbcOaNmcMM6glzLVU44CXH+OmLT3OVqh2Khe58w5 lFQGbYwvYgch2JrWVb2oXEEz6X4FZ3RKORDsELLluRxmQzoK9VoBPpXXYda6+VptE/xY X8ArlBvNpvny6Vq7FqXTL/J6VonrNKpLPrRhTMZmSZ7mMFpSt0FmXelPl1UlhJpE5hZR EEbu7FxU6MdpBGnfBeuRtHbv5m/B1XorrSOhoO7wNK7CMOQ8U8JCnGnz4cF9JCocBxS/ D2kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703083992; x=1703688792; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eBS/M67eqFyB1dRDgBWV3AQl//bHp4H9z6F6Hon/YZM=; b=erk8JrEC8KYxTBA2qYcJMafTUun/QE3gZf+IO/lHXdH11zjAH78J0wFqhMYF1T98TH wa+OmgZqQJRPfD+xEyIMsr4XGyRtXq78yZ0LDkxDeFfriv3FqLevW/X1IRJ27GB9YtPm dQ2hJbvZQlSET09ui+sD9gojaFAy9mpYNXS9/M6wFPzoLqJthfymc4aQXD7BX7bB+Y0l F/igDyuzKibOOd5+5mNtlPILl8bJ5KrDzMIfZhyWN+CHv5wayPbl2Ik7XvuqZ0KJXIVe noAcfCoe+QS88MGWCWy3eWCXETdljzSOeSXCp6oU5IvUlGILIPFyO8hWQF1N5AC9YlDH wcZw== X-Gm-Message-State: AOJu0YwS0yuYRNfaAW/fGfWYK8lYwzdq6DIqlC0w9RFmYlwDUEVYdXPy qZyPOssTcHVyBiSqDmGiIg+bpnMZ2f0= X-Received: by 2002:a05:6a20:3d82:b0:190:c386:3eb4 with SMTP id s2-20020a056a203d8200b00190c3863eb4mr10083440pzi.47.1703083992154; Wed, 20 Dec 2023 06:53:12 -0800 (PST) Received: from rigel (60-241-235-125.tpgi.com.au. [60.241.235.125]) by smtp.gmail.com with ESMTPSA id b31-20020a631b5f000000b005bdf59618f9sm20910003pgm.69.2023.12.20.06.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:53:11 -0800 (PST) Date: Wed, 20 Dec 2023 22:53:07 +0800 From: Kent Gibson To: Andy Shevchenko Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, brgl@bgdev.pl, linus.walleij@linaro.org Subject: Re: [PATCH 2/4] gpiolib: cdev: allocate linereq using kvzalloc() Message-ID: References: <20231220015106.16732-1-warthog618@gmail.com> <20231220015106.16732-3-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Dec 20, 2023 at 04:30:24PM +0200, Andy Shevchenko wrote: > On Wed, Dec 20, 2023 at 09:51:04AM +0800, Kent Gibson wrote: > > The size of struct linereq may exceed a page, so allocate space for > > it using kvzalloc() instead of kzalloc(). > > It might be this needs a bit of elaboration. The kmalloc() tries to allocate > a contiguous (in physical address space) chunk of memory and with fragmented > memory it might be not possible. So the above issue might (rarely) happen. > In most cases the call to kmalloc() will succeed. > For sure, the kzalloc() generally works - or we wouldn't've gotten this far as tests with MAX_LINES would've been failing. We are targetting a very niche failure mode here. The size allocated can only be determined at runtime, may be more or less than a page, and we don't care whether the physical memory allocated is contiguous. As such kvzalloc() is the appropriate allocator. Are you suggesting repeating the relevant sections of the kmalloc/vmalloc() documentation or Memory Allocation Guide as part of the checkin comment? Cheers, Kent.