From owner-svn-src-head@freebsd.org Mon Jan 8 18:08:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1D8FE7BBF1; Mon, 8 Jan 2018 18:08:09 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB1076A48F; Mon, 8 Jan 2018 18:08:09 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-x232.google.com with SMTP id q188so15567700iod.1; Mon, 08 Jan 2018 10:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vzmIsZVqzoC8kFyncDcqshvN9zlsRaDR3B2vkRk4KTU=; b=mBsMP1PPPm1YVByBbmFBN990pqVKFMSP7+RLr15gGJPw/nNgEsBbE4c5UmaNDohkWs 5FTm/vXsmFj6Id+CbUmKvw/8NUih+lh+3R55PUNnZDjCvf+aJ/ry2VTnX3XYrMRlquLJ DxTVnVRnepD6vLrXoZAZbv2re9URh6cyobUATh233QN+HySLccpTIM9gX8xX18ZBwnSC KYPxYSZ33/oAbii1EJXTu9OK6R/kVnVJF3N3E9A7eHFGDPvyATWezrPk+ATxDDcDSbUv M5l/GcCYXlLsxW/hwnpwQRv5aG+GdWWrG92uLyLRFkbK4Oew8chXHx+SfuRuzF82IePt 2ntQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vzmIsZVqzoC8kFyncDcqshvN9zlsRaDR3B2vkRk4KTU=; b=YXni+AX6ObE5uUHlhohw0IA6nIrXuSTehGaNBn62tP+q4xYzIENLjXOCydhICRZDK6 VCwvZhoNKmTO5oYo3qroW1CTN0w3PGH28by8dyfk3ZQNID03ZO23aG4LAHwokqPVe/by 38xSbapzhfcH2iK0l1jf51XvATHHTxoSobPRU1MTr89n6m9RpThpYQiBAcYHTvuoTsGY QNo5xqNjrSRd0lZkthKIazKuG0YGFRBagS5IXccwiHX1XdDmmUhCKzGHt2fVYFt/gD1y 83FnFlrc+CQZU3pljUUUTaznv00B7KPswnq0Wd7dvt7+0bWVn64oFHKC83/xbr9M48hq 0n/w== X-Gm-Message-State: AKGB3mK7mmKrj7sjxNzF8xUMMK1tCpb7jJyhKt2ONIWO7qFQblQqxnJe YvR6e1c51Qc3KdwnKCLx/6a81ncVy9zSQjpH2em9ERVW X-Google-Smtp-Source: ACJfBouIYKdvxerTQ5qC6SjOyrfgrnqjZKy681McOKVn4XjZoMEa9DiMp89Cz8/as2mzLGQyv+whV6osL8W5bby540Q= X-Received: by 10.36.47.207 with SMTP id j198mr12381787itj.119.1515434888913; Mon, 08 Jan 2018 10:08:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.15.193 with HTTP; Mon, 8 Jan 2018 10:08:08 -0800 (PST) In-Reply-To: <201801081541.w08Ffmm0052729@repo.freebsd.org> References: <201801081541.w08Ffmm0052729@repo.freebsd.org> From: Conrad Meyer Date: Mon, 8 Jan 2018 10:08:08 -0800 Message-ID: Subject: Re: svn commit: r327697 - head/sys/sys To: "Pedro F. Giffuni" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 18:08:10 -0000 Hi, Response inline. On Mon, Jan 8, 2018 at 7:41 AM, Pedro F. Giffuni wrote: > Author: pfg > Date: Mon Jan 8 15:41:48 2018 > New Revision: 327697 > URL: https://svnweb.freebsd.org/changeset/base/327697 > > Log: > malloc(9): drop the __result_use_check attribute for the kernel allocator. > > The __result_use_check attribute was brought to the kernel malloc in > r281203 for consistency with the userland malloc. > > For the case of the M_WAITOK flag, the kernel malloc(), realloc(), and > reallocf() cannot return NULL so in that case the __result_use_check > attribute makes no sense. > > We don't have any way of conditionalizing such attributes so just drop it. Could we conditionalize the attribute using two different names and a macro that inspected the (typically) constant flags argument? Something like this: #define malloc(s, t, f) \ (__builtin_constant_p(f) && (f & M_WAITOK) != 0) ? _malloc_waitok(s, t, f) : _malloc(s, t, f) void *_malloc(...) __malloc_like __alloc_size(1); void *_malloc_waitok(...) __malloc_like __result_use_check __alloc_size(1); The two names would just be aliases, or one could invoke the other as an inline function. Best, Conrad