C(EMPTY_SORT_FIELD,     "Empty sort field"),                    \
        C(TOO_MANY_SORT_FIELDS, "Too many sort fields (Max = 2)"),      \
        C(INVALID_SORT_FIELD,   "Sort field must be a key or a val"),   \
-       C(INVALID_STR_OPERAND,  "String type can not be an operand in expression"),
+       C(INVALID_STR_OPERAND,  "String type can not be an operand in expression"), \
+       C(EXPECT_NUMBER,        "Expecting numeric literal"),
 
 #undef C
 #define C(a, b)                HIST_ERR_##a
 #define HIST_FIELD_OPERANDS_MAX        2
 #define HIST_FIELDS_MAX                (TRACING_MAP_FIELDS_MAX + TRACING_MAP_VARS_MAX)
 #define HIST_ACTIONS_MAX       8
+#define HIST_CONST_DIGITS_MAX  21
 
 enum field_op_id {
        FIELD_OP_NONE,
        bool                            read_once;
 
        unsigned int                    var_str_idx;
+
+       /* Numeric literals are represented as u64 */
+       u64                             constant;
 };
 
 static u64 hist_field_none(struct hist_field *field,
        return 0;
 }
 
+static u64 hist_field_const(struct hist_field *field,
+                          struct tracing_map_elt *elt,
+                          struct trace_buffer *buffer,
+                          struct ring_buffer_event *rbe,
+                          void *event)
+{
+       return field->constant;
+}
+
 static u64 hist_field_counter(struct hist_field *field,
                              struct tracing_map_elt *elt,
                              struct trace_buffer *buffer,
        HIST_FIELD_FL_CPU               = 1 << 15,
        HIST_FIELD_FL_ALIAS             = 1 << 16,
        HIST_FIELD_FL_BUCKET            = 1 << 17,
+       HIST_FIELD_FL_CONST             = 1 << 18,
 };
 
 struct var_defs {
 {
        if (field->flags & HIST_FIELD_FL_VAR_REF)
                strcat(expr, "$");
+       else if (field->flags & HIST_FIELD_FL_CONST) {
+               char str[HIST_CONST_DIGITS_MAX];
+
+               snprintf(str, HIST_CONST_DIGITS_MAX, "%llu", field->constant);
+               strcat(expr, str);
+       }
 
        strcat(expr, hist_field_name(field, 0));
 
                goto out;
        }
 
+       if (flags & HIST_FIELD_FL_CONST) {
+               hist_field->fn = hist_field_const;
+               hist_field->size = sizeof(u64);
+               hist_field->type = kstrdup("u64", GFP_KERNEL);
+               if (!hist_field->type)
+                       goto free;
+               goto out;
+       }
+
        if (flags & HIST_FIELD_FL_STACKTRACE) {
                hist_field->fn = hist_field_none;
                goto out;
        return alias;
 }
 
+static struct hist_field *parse_const(struct hist_trigger_data *hist_data,
+                                     char *str, char *var_name,
+                                     unsigned long *flags)
+{
+       struct trace_array *tr = hist_data->event_file->tr;
+       struct hist_field *field = NULL;
+       u64 constant;
+
+       if (kstrtoull(str, 0, &constant)) {
+               hist_err(tr, HIST_ERR_EXPECT_NUMBER, errpos(str));
+               return NULL;
+       }
+
+       *flags |= HIST_FIELD_FL_CONST;
+       field = create_hist_field(hist_data, NULL, *flags, var_name);
+       if (!field)
+               return NULL;
+
+       field->constant = constant;
+
+       return field;
+}
+
 static struct hist_field *parse_atom(struct hist_trigger_data *hist_data,
                                     struct trace_event_file *file, char *str,
                                     unsigned long *flags, char *var_name)
        unsigned long buckets = 0;
        int ret = 0;
 
+       if (isdigit(str[0])) {
+               hist_field = parse_const(hist_data, str, var_name, flags);
+               if (!hist_field) {
+                       ret = -EINVAL;
+                       goto out;
+               }
+               return hist_field;
+       }
+
        s = strchr(str, '.');
        if (s) {
                s = strchr(++s, '.');
 
        if (flags & HIST_FIELD_FL_ALIAS)
                seq_puts(m, "        HIST_FIELD_FL_ALIAS\n");
+       else if (flags & HIST_FIELD_FL_CONST)
+               seq_puts(m, "        HIST_FIELD_FL_CONST\n");
 }
 
 static int hist_field_debug_show(struct seq_file *m,
                           field->var.idx);
        }
 
+       if (field->flags & HIST_FIELD_FL_CONST)
+               seq_printf(m, "      constant: %llu\n", field->constant);
+
        if (field->flags & HIST_FIELD_FL_ALIAS)
                seq_printf(m, "      var_ref_idx (into hist_data->var_refs[]): %u\n",
                           field->var_ref_idx);
 
        if (hist_field->flags & HIST_FIELD_FL_CPU)
                seq_puts(m, "common_cpu");
+       else if (hist_field->flags & HIST_FIELD_FL_CONST)
+               seq_printf(m, "%llu", hist_field->constant);
        else if (field_name) {
                if (hist_field->flags & HIST_FIELD_FL_VAR_REF ||
                    hist_field->flags & HIST_FIELD_FL_ALIAS)