Hi Pablo, 2017-03-14 20:19 GMT+08:00 Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>: [...] > Another possibility is to simply regard desc->size over the memory > scalability notation when provided. I think this just needs an update > from nft userspace. Look, bitmap and hashtable are both described as > O(1) in terms of performance. If the user provides the set size (this > is known in anonymous sets) we can select the one that takes less > memory. When no size is specified, we rely on the set policy that is > specified. > > Still, for anonymous sets we will select hashtable instead, this is > going to be slower in systems that have plenty of memory. I think we > cannot escape the new per-table global knob to select > memory/performance for anononymous sets after all. After we implement more and more sets types, I think just based on POL_PERFORMANCE or POL_MEMORY to select a suitable set will become a more and more difficult task. So how about this method: 1. For compatibility, POL_PERFORMANCE means hash set, and POL_MEMORY means rbtree set.(I know this maybe incorrect when the set->size is 0) 2. When the user create the set, he(she) can specify a new settype to select the set type, such as hash, rbtree, bitmap... a little similar to ipset. I know this method is not perfect, but this will provide big flexibility to the user. > I'm curious, what kind of device are you thinking of with such memory > restrictions that cannot take 320 kB? I would expect such embedded > device that cannot afford such memory consumption will come also with > a smallish cpu. We had a small router with 32MB memory in my previous company. On such an embedded device, occupy 320KB is also no problem of course. But I guess the user will not happy to know the fact, inputting such a nft rule "nft add x y tcp dport {21, 22} drop" will consume more than 16KB memory :) -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html